Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to trim or strip white spaces from a String while using Robot Framework

How to trim or strip white spaces from a String while using Robot Framework

If I have a string " Hello How are you " how to convert it to "HelloHowareyou" (stripping all the white spaces)

like image 829
binithb Avatar asked Jul 24 '13 11:07

binithb


1 Answers

Also ${str.strip()} works. It uses the Extended variable syntax Example:

*** Variables ***
${str}=    ${SPACE}${SPACE}${SPACE}foo${SPACE}${SPACE}${SPACE}

*** Test cases ***
print string
    log    ${str}         # will be printed with spaces around it
    log    ${str.strip()} # will be printed without spaces around it

Run with pybot -L TRACE to see what is being passed to log keyword.

like image 77
kontulai Avatar answered Oct 21 '22 21:10

kontulai