aboutsummaryrefslogtreecommitdiffhomepage
path: root/content/en/functions/strings/TrimSpace.md
blob: eef4e81214288bc35ab5a94963136e2d8db31a98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
---
title: strings.TrimSpace
description: Returns the given string, removing leading and trailing whitespace as defined by Unicode.
categories: []
keywords: []
action:
  related:
    - functions/strings/Chomp
    - functions/strings/Trim
    - functions/strings/TrimLeft
    - functions/strings/TrimPrefix
    - functions/strings/TrimRight
    - functions/strings/TrimSuffix
  returnType: string
  signatures: [strings.TrimSpace INPUT]
---

{{< new-in 0.136.3 >}}

Whitespace characters include `\t`, `\n`, `\v`, `\f`, `\r`, and characters in the [Unicode Space Separator] category.

[Unicode Space Separator]: https://www.compart.com/en/unicode/category/Zs

```go-html-template
{{ strings.TrimSpace "\n\r\t   foo   \n\r\t" }} → foo
```