Robot Framework : How to remove all spaces after the string

Viewed 370

I am new to robot framework. I want to know how can i remove all white spaces after the string . My string is "OTP Hello
" I want all spaces and line break after Hello to get deleted How can I achieve it?

1 Answers

Use the Strip String keyword in the Strings library, and specify mode=right, to remove the whitespace only from the right side. Sample:

${src}=     Set Variable    OTP Hello${SPACE}\n
Log To Console      The source: ---${src}---
${stripped}=   Strip String    ${src}      mode=right
Log To Console      The result: ---${stripped}---

The output will be:

The source: ---OTP Hello 
---
The result: ---OTP Hello---
Related