Reputation: 872
I am extracting data from MySQL that returns query results as follows:
${A} = (('HFL', 'TCFLORWWGMAFVFEQLVRN', 'ZZG', 1625, 'SA,WE,DN_IS,', 84))
In this part 'SA,WE,DN_IS,' the trailing Comma needs to be removed for data validation. I am using robot framework for this and created loops to extract data from the list and compare individual elements with data on the webpage. So far I did not find any method in Robot Framework, specially Collections Library that I can use to remove the trailing comma. Is there any way to remove it using Robot Framework? Thanks in advance for your help.
Upvotes: 0
Views: 3751
Reputation: 264
You can remove the trailing comma or any trailing character in a string by using "Get Substring" keyword of String library.
Example code:
*** Settings ***
Library String
*** Variables ***
${a}= SA,WE,DN_IS,
*** Test Cases ***
Remove last character of a string
log to console ${a}
${b}= Get Substring ${a} 0 -1
log to console ${b}
Upvotes: 3