# RTrim - script and chart function

RTrim() returns the input string trimmed of any trailing spaces.

Syntax:

RTrim(text)

Return data type: string

[](https://help.qlik.com/en-US/sense/Subsystems/Hub/Content/Sense_Hub/Scripting/StringFunctions/RTrim.htm)

#### Example: Chart expressions

| Example | Result |
| --- | --- |
| `RTrim( ' abc' )` | Returns ' abc' |
| `RTrim( 'abc ' )` | Returns 'abc' |

[](https://help.qlik.com/en-US/sense/Subsystems/Hub/Content/Sense_Hub/Scripting/StringFunctions/RTrim.htm)

#### Example: Load script

```
Set verbatim=1;  

T1:

Load *, len(RtrimString) as RtrimStringLength;        
Load *, rtrim(String) as RtrimString;
Load *, len(String) as StringLength;             
Load * Inline [
String
'   abc    '
' def  ']; 
				
```

Information noteThe "Set verbatim=1" statement is included in the example to ensure that the spaces are not automatically trimmed before the demonstration of the rtrim function. See [Verbatim](https://help.qlik.com/en-US/sense/November2024/Subsystems/Hub/Content/Sense_Hub/Scripting/SystemVariables/Verbatim.htm) for more information.

Result

| String | StringLength | RtrimStringLength |
| --- | --- | --- |
| def | 6 | 4 |
| abc | 10 | 6 |

## Learn more

* [LTrim - script and chart function](https://help.qlik.com/en-US/sense/November2024/Subsystems/Hub/Content/Sense_Hub/Scripting/StringFunctions/LTrim.htm)