---
title: rtrim
description: |
  Removes whitespace from the end of a string while leaving the beginning unchanged.
url: https://coralogix.com/docs/dataprime/language-reference/functions-reference/string/rtrim/
product: dataengine
feature: DataPrime Language
feature_id: dataprime-language
feature_identifier: dataengine/dataprime-language
last_updated: '2026-10-21'
---

# `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.md),<!-- --> **function** and **method**. These interchangeable forms allow flexibility in how you structure expressions.

* Function notation
* Method notation

```
rtrim(value: string): string
```

```
(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:

```
{

  "username": "SyntaxTerror    "

}
```

Use `rtrim` to remove the unwanted space:

### Example query

* Function notation
* Method notation

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

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

### Example output

```
{

  "username": "SyntaxTerror    "

  "trimmed_user": "SyntaxTerror"

}
```
