Skip to main content
Previous section   Next section

TRIMS

Removes leading and trailing spaces from each element of a dynamic array.

Synopsis

TRIMS(dynarray)

Arguments

dynarray An expression that resolves to a dynamic array.

Description

The TRIMS function trims leading and trailing blank spaces from each element of a dynamic array. It also replaces multiple (redundant) spaces within an element with a single space. It returns the resulting trimmed dynamic array.

To trim only trailing blank spaces from each element, use TRIMBS. To trim only leading blank spaces from each element, use TRIMFS.

You can use TRIM to remove both leading and trailing blanks from a string. You can use TRIMB to remove trailing blanks from a string. You can use TRIMF to remove leading blanks from a string.

Examples

The following example uses the TRIMS function to trim leading and trailing spaces:

RawDyn="North   ":@VM:"South   ":@VM:"  East":@VM:"West..."
PRINT LENS(RawDyn)
TrimDyn = TRIMS(RawDyn)
PRINT LENS(TrimDyn)
Copy code to clipboard

The following example uses the TRIMS function to trim redundant spaces within elements:

RawDyn="North    America":@VM:"Central     America":@VM:"South America"
PRINT LENS(RawDyn)
TrimDyn = TRIMS(RawDyn)
PRINT LENS(TrimDyn)
Copy code to clipboard

See Also