(trim string [flag])
Erase blank spaces in a string.
This function trims spaces from the specified string.
The optional flag argument represents the options for stripping spaces:
Flag | Meaning |
---|---|
none | Strip all spaces from beginning and end. |
"B" | Strip spaces from beginning of string. |
"M" | Strip spaces from middle of string. |
"E" | Strip spaces from end of string. |
"BE" | Strip spaces from beginning and end of string. |
"ME" | Strip spaces from middle and end of string. |
"BM" | Strip spaces from beginning and middle of string. |
Examples
Code | Returns |
---|---|
(setq a " Green Beans " ) | |
(trim a "B" ) | "Green Beans " |
(trim a "M" ) | " GreenBeans " |
(trim a "be") | "Green Beans" |
(trim a) | "Green Beans" |