Reputation: 47
Given String "Showing 1 to 10 of 3,311 entries". I need to get the 3,311 separately form that string. I can use this ${Number} = Get Substring ${countString} 19 24
but here problem is index was changed.
Upvotes: 1
Views: 20643
Reputation: 2813
You can use the Split String
keyword and separate the each part of string by ${SPACE}
Additionaly I removed ,
from the number just in case you need it. Slightly different way to achieve same - https://stackoverflow.com/a/57786634/5400362
*** Variable ***
${string1}= Showing 1 to 10 of 3,311 entries
*** Testcases ***
Get Number From String
@{list_string}= split string ${string1} ${SPACE}
log ${list_string}[5]
${num}= evaluate '${list_string}[5]'.replace(',','')
output
Upvotes: 3