You are here: Functions > ALLTRIM()

ALLTRIM()

ALLTRIM() returns a variable length string with leading and trailing blanks removed. Blanks inside the character string are not removed.

Optionally, ALLTRIM() can also be used to remove other specified leading and trailing characters.

ALLTRIM() is similar to LTRIM(), which removes leading blanks and to TRIM(), which removes trailing blanks.

Note: The trimming operation starts at each end of the string and will stop as soon as it encounters a character that is not a blank or an optional character.

Function Format

ALLTRIM(C,<"characters_to_remove">)

C is a character string
characters_to_remove is an optional list of non-blank leading or trailing characters to be removed

Examples

ALLTRIM(" abc ") = "abc"

ALLTRIM(" a bc ") = "a bc"

ALLTRIM(" 001010 00","0") = "101"

ALLTRIM(" 1230540 00","0123") = "54"