Strings

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

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

For other text processing functions, see the Workflows standardlibrarytext 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}"}]}}]

Important: In YAML, expressions containing colons can cause unexpectedbehaviour when the colon is interpreted as defining a map. You can resolve thisissue by wrapping the YAML expression in single quotes:

Recommended:'${"thisVar: " + myVar}'

Not recommended:${"thisVar: " + myVar}

For details, see
Expressions containing colons.

Concatenate over multiple lines

Since each assignment is processed sequentially, you can concatenate a stringover multiple lines by repeating the variable and splitting the assignment. Forexample:

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}"}}]}}

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.