> For the complete documentation index, see [llms.txt](https://daseldocs.tomwright.me/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://daseldocs.tomwright.me/functions/trim.md).

# trim

Trims whitespace from both ends of a string.

#### Syntax

```
trim(input)
```

or chained:

```
<string>.trim()
```

#### Arguments

* **input** (`string`, optional when chained) - The string to trim.

#### Examples

**Function call**

```
trim("  hello  ")
// "hello"
```

**Chained usage**

```
"  hello world  ".trim()
// "hello world"
```

**CLI usage**

```bash
$ echo '{"value": "  spaced  "}' | dasel -i json 'value.trim()'
spaced
```
