TRIM function
Removes leading and trailing white space, or other specified characters, from a CHARACTER or LONGCHAR expression.
Syntax
expression
trim-chars
ExamplesThe following procedure displays a menu that you can use to display Customer and Order information. The option numbers are displayed with leading spaces. The TRIM function removes the leading white space so the menu selection can be easily evaluated.
The following example reads a text file and breaks it into words. It assumes that all words are separated by at least one space character. It uses the TRIM function with one parameter to remove white space from the ends of each input line. It then uses the TRIM function with two parameters to remove any punctuation characters from each word.
Notes
- The TRIM function is double-byte enabled. The specified
expression
andtrim-chars
arguments can contain double-byte characters. TRIM does not remove double-byte space characters by default.- A character string displays with the default format of x(8), unless you specify a format or use a statement such as DISPLAY @
literal
.- You can use the DEBLANK option of the Format phrase to remove leading spaces for fields in the input buffer.
- If
expression
is a case-sensitive field or variable, thentrim-chars
is also case sensitive. Otherwise,trim-chars
is not case sensitive.See also
OpenEdge Release 10.2B
|