contents.gifindex.gifprev1.gifnext1.gif

Trim, Trim$

Purpose

Returns a copy of a string with both leading (leftmost) and trailing (rightmost) spaces removed.

Arguments

Trim[$]( stringexpr )

Notes

Trim[$] removes leading and trailing spaces from a string.

Trim returns a Variant; Trim$ returns a String. The stringexpr argument can be any string expression. However, only Trim can accept a Variant of Null as stringexpr, in which case, a Null is returned.

Example

This example uses Trim to strip leading and trailing spaces from the variable TestString.

StripBothSpace = Trim(TestString) // Strip leading and trailing spaces.