---
title: "trim_space | Grafana Agent documentation"
description: "Learn about trim_space"
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# trim\_space

`trim_space` removes any whitespace characters from the start and end of a string.

## Examples

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
> trim_space("  hello\n\n")
"hello"
```
