| 1 |
--- |
| 2 |
title: strings.TrimSpace |
| 3 |
description: Returns the given string, removing leading and trailing whitespace as defined by Unicode. |
| 4 |
categories: [] |
| 5 |
keywords: [] |
| 6 |
params: |
| 7 |
functions_and_methods: |
| 8 |
returnType: string |
| 9 |
signatures: [strings.TrimSpace STRING] |
| 10 |
--- |
| 11 |
|
| 12 |
{{< new-in 0.136.3 />}} |
| 13 |
|
| 14 |
Whitespace characters include `\t`, `\n`, `\v`, `\f`, `\r`, and characters in the [Unicode Space Separator][] category. |
| 15 |
|
| 16 |
```go-html-template |
| 17 |
{{ strings.TrimSpace "\n\r\t foo \n\r\t" }} → foo |
| 18 |
``` |
| 19 |
|
| 20 |
[Unicode Space Separator]: https://www.compart.com/en/unicode/category/Zs |