---
url: /cube-functions/trim.md
description: >-
  Strips all whitespace or any characters you specify from both the beginning
  and end of the input string and returns the result.
---

# TRIM

Strips all whitespace or any characters you specify from both the beginning and end of the input string and returns the result.

```js
TRIM(input_string, characters_to_trim)
```

#### Parameters

* `input_string` - The string to be trimmed.
* `characters_to_trim` - Characters to remove from the start and end of the string. Defaults to whitespace. `(optional)`

#### Examples

```js
TRIM(" Hello World  ")
```

**Result:** `Hello World`

```js
TRIM("--Foo-Bar--", "-")
```

**Result:** `Foo-Bar`
