# 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://a.sfdcstatic.com/developer-website/sfdocs/analytics/media/bi_dev_guide_saql/rtrim.png)
