LTrim, RTrim, Trim Functions
Returns a copy of a string without leading spaces (LTrim), trailing spaces (RTrim), or both leading and trailing spaces (Trim).
Syntax
LTrim(string)
RTrim(string)
Trim(string)
Remarks
The string argument is any valid string expression.
The following example uses the LTrim
, RTrim
, and
Trim
functions to trim leading spaces, trailing spaces, and
both leading and trailing spaces, respectively:
Example:
Dim MyVar
MyVar = LTrim(" BSL ") ' MyVar contains "BSL ".
MyVar = RTrim(" BSL ") ' MyVar contains " BSL".
MyVar = Trim(" BSL ") ' MyVar contains "BSL".
MyVar = Trim(Null)
' Output: Null