TRIMR

The TRIMR function returns the given string with any trailing blacks removed, or the given string with any trailing specified characters removed.

The type of the function is alphanumeric, DBCS, or national depending on the class of its argument.

Format

Read syntax diagramSkip visual syntax diagramFUNCTION TRIML(argument-1 argument-2)
argument-1
Must be a nonnumeric literal or data item of class alphabetic, alphanumeric, DBCS, or national. Argument-1 identifies the source string for the trim.
argument-2
If specified, it must be a nonnumeric literal or data item of the same class as argument-1. It specifies the characters to trim off. If not specified, the trim character defaults to blank.

If argument-2 is not specified, the returned value is an alphanumeric, DBCS, or national character string that consists of the characters of argument-1 with any leading blanks removed. The blank character is a 1-byte space character (' ' or X'40') when argument-1 is of class alphanumeric, or one double-byte space (X'4040') when argument-1 is of class DBCS, or one national space (X'0020' or X'3000') when argument-1 is of class national.

If argument-2 is specified, the returned value is an alphanumeric, DBCS, or national character string that consists of the characters of argument-1 with any trailing characters specified in argument-2 removed.

The length of the returned string depends on the content and the class of argument-1. It is the length of the returned string in number of character positions. If argument-1 is a DBCS or national data item, the length is in DBCS or national character positions.

For more information on returned values and examples, see TRIM.

Related references  
TRIM