How to get rest of the values from the variable
${random employee}= Convert To String ${random emp}
${replace}= Remove String Using Regexp ${random employee} ['\\[\\]\\,]
${splitline}= Fetch From Left ${replace} ${SPACE}
Output:
${replace} Alagu [email protected][email protected] Developer Team B3 Team lead
${splitline} = Alagu
How to get rest of the values from the variable ${replace}
Splits the string using separator as a delimiter string. If a separator is not given, any whitespace string is a separator. In that case also possible consecutive whitespace as well as leading and trailing whitespace is ignored. Split words are returned as a list.
Run with pybot -L TRACE to see what is being passed to log keyword. This only removes spaces around it. Since Robotframework 3.0 this can also be done with Strip String in the String library. To remove all spaces from the string use the solution from Grant McCloskey.
Keyword Split String
from String
standard library does this.
Split String string, separator=None, max_split=-1
Splits the string using separator as a delimiter string.
If a separator is not given, any whitespace string is a separator. In that case also possible consecutive whitespace as well as leading and trailing whitespace is ignored.
Split words are returned as a list. If the optional max_split is given, at most max_split splits are done, and the returned list will have maximum max_split + 1 elements.
Examples:
@{words} = Split String ${string}
@{words} = Split String ${string} ,${SPACE}
To get single values from @{words}
use common array syntax: @{NAME}[i]
. i
is the index of the selected value. Indexes start from zero.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With