Domanda

I have a variable with value "x: 647, y: 1174" and I would like to parse them into two separate variables: ${x} = 647 and ${y} = 1174

Is this possible within Robot Framework?

È stato utile?

Soluzione

String library will help you.

${var}    Set Variable    x: 647, y: 1174
${x}    Fetch From Left    ${var}    ,    # now x should be "x: 674"
${x}    Fetch From Right    ${x}    ${SPACE}    # and now it should be "674"
${y}    Fetch From Right    ${var}    y:${SPACE}

Or write a python function that does the same with regex for example.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top