# `trim`

## Description

Removes whitespace from both the start and end of a string.

## Syntax

Like many functions in DataPrime, `trim` supports [two notations](https://coralogix.com/docs/dataprime/language-reference/functions-reference/index.md), **function** and **method** notation. These interchangeable forms allow flexibility in how you structure expressions.

```dataprime
trim(value: string): string
```

```dataprime
(value: string).trim(): string
```

## Arguments

| Name  | Type   | Required | Description        |
| ----- | ------ | -------- | ------------------ |
| value | string | **true** | The string to trim |

## Example

**Clean up an extracted username**

Use `trim` to remove the extra spaces:

### Example data

```json
{
  "username": "    SyntaxTerror    "
}
```

### Example query

```dataprime
create trimmed_user from trim(username)
```

```dataprime
create trimmed_user from username.trim()
```

### Example output

```json
{
  "username": "    SyntaxTerror    ",
  "trimmed_user": "SyntaxTerror"
}
```
