TRIM

TRIM(value)[source]

Removes leading and trailing whitespace from a string or string array.

This function trims whitespace from each element if the input is a string array, or from the single string if the input is scalar.

Parameters:

value (Operand | str) –

The string or string array to trim.

Supported types:

  • STRING

  • STRING_ARRAY

Return type:

Formula

Returns:

A formula representing the trimmed string(s).

Supported types:

  • STRING

  • STRING_ARRAY (if the input was an array)

Raises:

ValueError – If the input value is not STRING or STRING_ARRAY.

Examples

Trim a single string:

TRIM("  hello world  ")
# Returns "hello world"

Trim a string array:

TRIM(["  foo  ", " bar "])
# Returns ["foo", "bar"]