Mia
Mia

Reputation: 448

How to get particular text from a string using robot framework?

I need to get the number before ':' from a string using robotframework how can I do it?

${str}=    Set Variable  7939:customer-Id:123a34ghas

I need to get only 7939 before ':' how can I do it in the robot framework?

${Id}=   split string ${str}
log to console   ${Id} #Should give only 7939

Upvotes: 1

Views: 1311

Answers (1)

Mia
Mia

Reputation: 448

${str}=    Set Variable    7939:customer-Id:123a34ghas

${Id}=    split string    ${str}    :

log to console    ${Id}[0]    #prints 7939

Upvotes: 2

Related Questions