Skip to main content

Text.trim

trimwherewhat

Group: Text

Documentation

This function removes the specified trim_characters, by default any whitespace, from the start, the end, or both ends of the input.

Arguments

  • where: The location of where to trim the input. By default, this function trims both ends of the input.
  • what: Either a Text containing characters that should be removed or a predicate taking single character strings and specifying if they should be removed. By default, all Unicode whitespace is removed.

Examples

Trimming whitespace from a string.

      " Hello! ".trim == "Hello!"
" Hello! ".trim ..Left == "Hello! "
" Hello! ".trim ..Right == " Hello!"

Trimming a specific set of letters from a string.

     "ABC123".trim ..Left "ABC" == "123"
"ABBA123".trim ..Left "ABC" == "123"