5

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}

1 Answer 1

6

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: @{words}[i]. i is the index of the selected value. Indexes start from zero.

Update: Since Robot Framework 3.1 the way to access an item in list is: ${words}[i].

Sign up to request clarification or add additional context in comments.

5 Comments

@{words} = Split String ${replace} ,${SPACE} output: @{word} Alagu [email protected][email protected] Developer Team B3 Team lead how to get devleoper team or b3 from here
can anyone tell me how to get the value from @{words}
if i use ${pick}= Get From List @{words} 2 output :${pick} a i want the full text like Developer Team
What do exactly you want to get from output and what do you want to do with it?
@karthikas I added info how you get single values from @{words}.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.