strings.TrimSpace
Returns the given string, removing leading and trailing whitespace as defined by Unicode.
- Syntax
- strings.TrimSpace STRING
- Returns
- string
Usage
The strings.TrimSpace function returns the given string, removing leading and trailing whitespace as defined by Unicode. Whitespace characters include \t, \n, \v, \f, \r, and characters in the Unicode Space Separator category.
Examples
{{ strings.TrimSpace "\n\r\t foo \n\r\t" }} → fooLast updated:
October 28, 2026
:
content: Apply style guide to strings functions (d6de31ebd)
Improve this page