Simplest way to concatenate two strings in robot framework .?
In Variable
part, I used the most simple interpolation
${a} Hello
${b} World
${c} ${a}${b}
You can use Catenate from BuiltIn
.
Example from docs:
${str1} = Catenate Hello world
${str2} = Catenate SEPARATOR=--- Hello world
${str3} = Catenate SEPARATOR= Hello world
=>
${str1} = 'Hello world'
${str2} = 'Hello---world'
${str3} = 'Helloworld'
Catenate
is the usual way to go with strings, as pointed in the other answer.
Alternative option is to use just Set Variable
:
${a}= Set Variable First
${b}= Set Variable Second
${c}= Set Variable ${a}${b}
Log To Console ${c} # prints FirstSecond
${c}= Set Variable ${a} ${b}
Log To Console ${c} # prints First Second
${c}= Set Variable ${a}-/-${b}
Log To Console ${c} # prints First-/-Second
The explaination is that the RF processing of any keyword's arguments - Set Variable
including, goes through substituting any variable with its value. E.g. for this call:
Set Variable ${a}-/-${b}
What roughly happens is "the end value is the value of variable a
-/-the value of variable b
".