Skip to main content

trim

Trims leading, trailing, and internal whitespace from a string.

There is a project setting for whitespace collapsing — see Settings > Postprocessing.

Parameters

  • STRING (string)

    The input string.

  • COMPACT INTERNAL (Boolean)

    Optional. Whether to trim internal whitespace.

    Default: false

Examples

The image below shows two calls to trim. Both have an input string that includes two spaces after a period.

trim1.png

The printed output is:

trim2.png

The result from the first call has reduced the two spaces to one. This is because the second parameter is set to true (the default). The result from the second call retains the two spaces as the second parameter is set to false.