clip()

The strLib.clip() string-formatting function deletes leading and trailing blank spaces and null values from returned strings.

If you do not specify an optional clipping code, the function defaults to option 2 (trim trailing blanks and nulls only).

Syntax

  strLib.clip(text STRING? in
    [, code INT? in])
  returns (result STRING?)
text
Input can be any variable or expression that is assignment compatible with the STRING type (see "Assignment compatibility in EGL").
code
An INT compatible variable or expression with one of the following values:
0
Leading and trailing blanks and nulls
1
Leading blanks and nulls only
2
Trailing blanks and nulls only
result
The string text, stripped of leading and trailing blank spaces and nulls. If either parameter has a null value, the function returns a null value. If code is not valid, the function returns the string unchanged.

Examples

  message01 STRING = "   Customer Record    ";
  result STRING;

  result = strLib.clip(message01, 0);
  // result is "Customer Record"

Feedback