---
updatedAt: 2025-12-05T18:41:41.000Z
agentTools:
  projectIndex: https://docs.observeinc.com/llms.txt
---

# trim

```
trim(str: string, [chars: const string]?) -> string
```

`trim` removes leading and trailing characters from a string.

The default value for `chars` is `' '` (a single space character). If `chars` is not specified, `trim` removes all leading and trailing spaces.

See also `ltrim`, `rtrim`.

# Domain

This is a scalar function (calculates a single output value for a single input row).

# Categories

* [String](function#string-functions)

# Examples

<OpalCodeBlock code={
`make_col trimmed_kind:trim(bundle_kind, ' ')
`}/>

Removes leading and trailing spaces from bundle kinds