Description
Deletes extra blank spaces from a character string or variable.
Syntax
blankless = Trim (expression)
blankless = TrimB (expression)
blankless = TrimF (expression)
Parameters
The Trim functions accept arguments for the following parameter.
Parameter | Description |
---|---|
Expression | Any legal BASIC+ expression. |
Multiple consecutive spaces can be deleted from a character string or variable by using the Trim function. The unneeded blanks preceding the first valid character string and those extra blanks following the last valid characters are deleted along with any extra blanks separating valid words.
See Also
The ETMethod() function removes the empty rows from an edit table or DataSet.
Example 1
In the following examples, ^ indicates a blank space.
T = "^^^^^EXTRA^^^BLANKS^^TAKE^^^UP^^Space^^^" T = Trim(T)
The extra blanks will be trimmed and the variable identifier T is as:
EXTRA^BLANKS^TAKE^UP^Space
The TrimB function deletes blank spaces at the end of a character string. Using the same example as above, TrimB(T) would generate:
^^^^EXTRA^^^BLANKS^^TAKE^^^UP^^Space
The TrimF function deletes spaces from the front of a character string. Using the same example as above, TrimF(T) would generate:
EXTRA^^^BLANKS^^TAKE^^^UP^^Space^^^
Example 2
string = "Dear^Mr.^Leu^^^:" string = Trim(string) * string is "Dear Mr. Leu:" first = "^^ROBERT^^^" middle = "E." last = "LEWIS^^^^" NAME = Trim(first:middle:last) * The name is trimmed to the string value "ROBERT^E.^LEWIS" X = "^^^1^^^2^^3^4^^^" output =TrimF(X) *output is 1^^^2^^3^4^^^