TRIMS()

TRIMS()

Top  Previous  Next

 

The TRIMS() function removes excess characters from strings in a dynamic array, operating on each element in turn and returning an equivalently structured dynamic array of trimmed strings.

 

 

Format

 

TRIMS(string)

TRIMS(string, character{, mode})

 

where

 

stringevaluates to the string to be trimmed.

 

characteris the character to be removed

 

modeevaluates to a single character which determines the mode of trimming:
ARemove all occurrences of character.
BRemove all leading and trailing occurrences of character.
CReplace multiple instances of character with a single character.
DRemove all leading and trailing spaces, replacing multiple embedded spaces with a single space.  The value of character is ignored.
ERemove all trailing spaces.  The value of character is ignored.
FRemove all leading spaces.  The value of character is ignored.
LRemove all leading occurrences of character.
RRemove all leading and trailing occurrences of character, replacing multiple embedded instances of character with a single character.
TRemove all trailing occurrences of character.

 

 

The first format of the TRIMS() function removes all leading and trailing spaces from each dynamic array element of string and replaces multiple embedded spaces by a single space.

 

The second form is more generalised and allows other characters to be removed.

 

 

Example

 

A = "  1  2  3  " : @FM : "  4  5  6"

B = TRIMS(A)

 

B becomes "1 2 3FM4 5 6"

 

 

See also:

TRIM(), TRIMB(), TRIMF(), TRIMW()