Progress
Language Reference
TRIM Function
Removes leading and trailing white space, or other specified characters, from a character string.
SYNTAX
string
A character expression. The string can be defined as a constant, field name, variable name, or expression. If string is a case-sensitive variable, Progress performs a case-sensitive trim.
trim-chars
A character expression that specifies the characters to trim from string. If you do not specify trim-chars, the TRIM function removes spaces, tabs, line feeds, and carriage returns.
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 string and trim-chars argument 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 string is a case-sensitive field or variable, then trim-chars is also case sensitive. Otherwise, trim-chars is not case sensitive.
SEE ALSO
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |