Search code examples
pythonrobotframeworkrobotframework-ide

Simplest way to concatenate two strings in robot framework .?


Given two strings 'a' , 'b', what is the simplest way to concatenate them and assign to a new variable in robot framework.?

I tried this simple pythonic way, but it didn't work

${var}= 'a' + 'b'

Solution

  • 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'