Skip to main content
Previous sectionNext section

LTrim, RTrim, and Trim

Returns a copy of a string without leading spaces (LTrim), trailing spaces (RTrim), or both leading and trailing spaces (Trim).

Synopsis

LTrim(string)

RTrim(string)

Trim(string)

Arguments

The string argument is any valid string expression.

Examples

The following example uses the LTrim, RTrim, and Trim functions to trim leading spaces, trailing spaces, and both leading and trailing spaces, respectively:

Dim MyVar
MyVar = LTrim("  Caché ")  'MyVar contains "Caché ".
Println Len(MyVar),":",MyVar,":"
MyVar = RTrim("  Caché ")  'MyVar contains "  Caché".
Println Len(MyVar),":",MyVar,":"
MyVar = Trim("  Caché ")   'MyVar contains "Caché".
Println Len(MyVar),":",MyVar,":"
Copy code to clipboard

See Also