Trim Spaces From String Method

The Trim Spaces From String method removes leading and trailing spaces from a string. It returns a copy of this string with the leading and trailing spaces removed. Note the following:

  • It accepts expressions of type string.

  • It accepts any type of string, including numeric values, and converts the input value to a string.

  • If the value that the string argument contains is NULL, then this method returns a Null variant. For more information, see Variants.

Format

Trim[$](string)

For information about the dollar sign, see Usage of the Dollar Sign.

The following table describes the arguments that you can use with this method.

Argument Description

string

A literal or expression from which this method removes leading and trailing spaces.

Example

For an example, see Get Substring Method.