---
schema_version: "1"
id: 9005349dc02e4972ab6d06a25207d062463f29d98c5147a258c31278a4d09c9d
title: rtrim()
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/bi_dev_guide_saql/guides/reference/bi-saql-functions-string-rtrim.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/guide/bi-saql-functions-string-rtrim.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: b02e93fca63eb67b7636c8f9d9817c96d688fb6efa25657e215cc879fc22502c
products:
  - Analytics SAQL Developer Guide
  - analytics
---

# rtrim()

Removes the specified characters from the end of a string.

## Syntax

`rtrim`(_string_,_substr_)

## Usage

Removes every instance of each character in _substr_ from the end of _string_. This function is case-sensitive. To remove trailing spaces, do not specify a value for _substr_.

## Example

This example shows that `rtrim` removes the specified characters from the end of a string. This function is case-sensitive.

```nolang
q = load "test";
q = foreach q generate 'Company' as 'Company', rtrim('Company',"abc") as 'rtrim abc',
    rtrim('Company',"cba") as 'rtrim cba', rtrim('Company',"ab") as 'rtrim ab',
    rtrim('Company',"ac") as 'rtrim ac';
```

![Diagram showing number of close opps, grouped by day of the week they were closed.](https://developer.salesforce.com/media/bi_dev_guide_saql/rtrim.png)
