Strings

The Workflows syntax supports a string data type with UTF‑8 encoding (maximum length).

For information on conversion and built-in string functions, see Data types, functions, operators.

For other text processing functions, see the Workflows standard library text module reference.

Assign a string variable

The value of a static string can be assigned to a variable. For example:

YAML

 - step:  assign:  - string: "hello"  

JSON

 [  {  "step": {  "assign": [  {  "string": "hello"  }  ]  }  }  ]  

Concatenate using expressions

You can dynamically concatenate strings using expressions and the + operator. For example:

YAML

 - step:  assign:  - outputVar: ${"Hello, " + firstName}  

JSON

 [  {  "step": {  "assign": [  {  "outputVar": "${\"Hello \" + firstName}"  }  ]  }  }  ]

Concatenate over multiple lines

Since each assignment is processed sequentially, you can concatenate a string over multiple lines by repeating the variable and splitting the assignment. For example:

YAML

main:  steps:  - assign_vars:  assign:  - concatLines: "say"  - concatLines: ${concatLines+" "+"hello"}  - concatLines: ${concatLines+" "+"to the world"}  - returnOutput:  return: ${concatLines}

JSON

{  "main": {  "steps": [  {  "assign_vars": {  "assign": [  {  "concatLines": "say"  },  {  "concatLines": "${concatLines+\" \"+\"hello\"}"  },  {  "concatLines": "${concatLines+\" \"+\"to the world\"}"  }  ]  }  },  {  "returnOutput": {  "return": "${concatLines}"  }  }  ]  } }