TRIM: Removing Leading and Trailing Occurrences

How to:

The TRIM function removes leading and/or trailing occurrences of a pattern within a character string.


Top of page

x
Syntax: How to Remove Leading and Trailing Occurrences
TRIM('trim_where', source_string, length, pattern, sublength, output_format)

where:

trim_where

Alphanumeric

Is one of the following, which indicates where to remove the pattern:

'L' removes leading occurrences.
'T' removes trailing occurrences.
'B' removes both leading and trailing occurrences.

source_string

Alphanumeric

Is the string to trim.

length

Integer

Is the number of characters in the source_string.

pattern

Alphanumeric

Is the character string pattern to remove.

sublength

Integer

Is the number of characters in the pattern.

output_format

Alphanumeric



Example: Removing Leading Occurrences

TRIM removes leading occurrences of the characters BR from DIRECTOR and stores the result in a column with the format A17:

TRIM('L', DIRECTOR, 17, 'BR', 2, 'A17')

For BROOKS R., the result is OOKS R.

For ABRAHAMS J., the result is ABRAHAMS J.


iWay Software