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

# 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"
```
