Browse the docs

trim

Removes spaces, tabs and line breaks from both ends of the text.

Keyboard Maestro: trim

Details #

trim(text) takes exactly one argument and returns text without leading or trailing whitespace (spaces, tabs and newlines). Whitespace in the middle stays.

Parameters #

Takes 1 argument. {{ trim(text) }}

Examples #

trim("  hi there \n")
→ hi there
length(trim(raw))
→ 3
Sample variableValue
raw abc

Gotchas #

  • The \n in an expression text is a line break. Other backslash pairs drop the backslash, so write "\\" for one backslash.