0

How do I grab the last number in a stored variable or string?

For example, I stored the string "1 out of 28" to "out"

Heres what I got on Selenium so far

storeText   xpath=/html/body/div[3]/div[4]/div[2]/div[2]/div[2]/div/div/div[2]/div[2]/table/tbody/tr[2]/td[4]   out
storeEval   parseInt(storedVars['out'])   out1
echo   ${out1}

It echoed 1. I want to grab that number (1) and the last number (28) to compare it with something later on.

How do I grab 28 from the string?

4

1 回答 1

0

没关系,我找到了答案。

storeEval   '${out}'.split(' ').last()   result
于 2012-08-22T18:12:59.320 回答