Method: Trim
Function name: trim
Parameter list: (CHAR value, CHAR trim_location, CHAR trim_char)
Return type: CHAR
What the method does: Strips all occurrences of the specified leading character from the input, the specified trailing character, or both.
Specify:
Character input value
Location indicator: an uppercase quoted string ('L', 'T', or 'B')
Note: Trim location character must be one of the following:
-
L
-
T
-
B
Trim character: If this is a literal, it must be just one character. For example, to trim trailing, lowercase “s” values:
trim(C5, 'T', 's');
where C5 is a character column name.
With this specification and given the following value for the C5 column:
ABCDEss-Ss
The return value would be:
ABCDEss-S
The following expression trims the trailing “s” and the trailing “S”:
ABCDEss-Ss:
trim(trim('ABCDEss-Ss', 'T', 's'), 'T', 'S');
This yields the result: ABCDESS.
Refer to Numeric Conversion Routines for more information.