RTrim function

Syntax

RTrim(string[, trim_string])

Description

Use the RTrim function to remove characters, usually trailing blanks, from the right of a string.

If you need to trim a quotation mark, you need to escape it with a single ". For example

&TRIMMED = RTrim(&NAME, """");

Parameters

Parameter Description

string

A String from which you want to remove trailing characters.

trim_string

A String consisting of a list of characters, all occurrences of which are removed from the right of string. Characters in trim_string that occur in string to the left of any character not in trim_string are be removed. If this parameter is not specified, " " is assumed.

Returns

Returns a String formed by deleting, from the end of source_str, all occurrences of each character specified in trim_str.

Example

The following example removes trailing blanks from &NAME and places the results in &TRIMMED:

&TRIMMED = RTrim(&NAME);

The following example removes trailing punctuation marks from REC.INP and places the results in &TRIMMED:

&TRIMMED = RTrim(REC.INP, ".,;:!?");

Related Topics