# `rtrim`

## Description

Removes whitespace from the end of a string while leaving the beginning unchanged.

## Syntax

Like many functions in DataPrime, `rtrim` 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
rtrim(value: string): string
```

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

## Arguments

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

## Example

**Clean up an extracted username**

Consider the following document:

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

Use `rtrim` to remove the unwanted space:

### Example query

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

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

### Example output

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