TRIM() |
![]() ![]() ![]() |
The TRIM() function removes excess characters from a string.
Format
TRIM(string) TRIM(string, character{, mode})
where
The first format of the TRIM() function removes all leading and trailing spaces from string and replaces multiple embedded spaces by a single space.
The second form is more generalised and allows other characters to be removed.
Examples
X = " 1 2 3 " Y = TRIM(X)
This program fragment removes excess spaces from string X setting Y to "1 2 3"
X = "ABRACADABRA" Y = TRIM(X, 'A', 'A')
This program fragment removes all occurrence of the letter A from string X setting Y to "BRCDBR"
X = "ABRACADABRA" Y = TRIM(X, 'A', 'B')
This program fragment removes leading and trailing occurrences of the letter A from string X setting Y to "BARCADABR"
See also: |