Skip to main content

trim

trim(input: String) : String

Returns input with all leading and trailing whitespace removed, including the space, tab, newline, form feed, and carriage return characters. Whitespace between other characters is left in place. For example, trim(" hello ") is "hello".

Examples:

  • trim(" hello ") returns "hello"
  • trim("no padding") returns "no padding"
  • trim(" ") returns "" (empty string, because the input is all whitespace)
  • trim(" hello world ") returns "hello world" (because only leading & trailing space is removed)
Null input

trim terminates the query with an error when input is null. Guard against null values with an isPresent() condition first.

See also​

Types​

Functions​