strings.trimSpace() function

The strings.trimSpace() function removes leading and trailing spaces from a string.

*Output data type: String*

  1. import "strings"
  2. strings.trimSpace(v: " abc ")
  3. // returns "abc"

Parameters

v

String to remove spaces from.

*Data type: String*

Examples

Trim leading and trailing spaces from all values in a column
  1. import "strings"
  2. data
  3. |> map(fn: (r) => ({ r with userInput: strings.trimSpace(v: r.userInput) }))

Related articles