Purpose |
Return a copy of a
|
Syntax |
NewString$ = TRIM$(OldString$ [, [ANY] CharsToTrim$]) |
Remarks |
TRIM$ combines the functionality of LTRIM$ and RTRIM$ into a single function. OldString$ is the string expression from which to remove characters, and CharsToTrim$ is the string expression to remove leading and trailing occurrences. If CharsToTrim$ is not specified, TRIM$ removes leading and trailing spaces. |
ANY |
If the ANY keyword is included, CharsToTrim$ specifies a list of single characters to be searched for individually, a match on any one of which as a leading or trailing character will cause the character to be removed from the result. |
Restrictions |
TRIM$ is case sensitive, so capitalization matters. TRIM$ is often used to remove the leading space returned by a STR$ conversion. While this method does work perfectly, it is a common misuse simply because STR$ will never return any trailing space characters. On this basis, the use of LTRIM$(STR$(x&)) is more efficient than TRIM$(STR$(x&)). Alternatively, FORMAT$(x&) may be used, since trimming of space characters is unnecessary. |
See also |
FORMAT$, INSTR, LCASE$, LTRIM$, MCASE$, MID$, REMOVE$, REPLACE, RIGHT$, RTRIM$, TALLY, UCASE$, VERIFY |