Trim

Description

Removes leading and trailing spaces from a string.

Syntax

Trim ( string )

Argument

Description

string

The string you want returned with leading and trailing spaces deleted

Returns

String. Returns a copy of string with all leading and trailing spaces deleted if it succeeds and the empty string ("") if an error occurs. If string is null, Trim returns null.

Usage

Trim is useful for removing spaces that a user may have typed before or after newly entered data.

Examples

Example 1

This statement returns BABE RUTH:

Trim(" BABE RUTH ")

Example 2

This example removes the leading and trailing spaces from the user-entered value in the SingleLineEdit sle_emp_fname and saves the value in emp_fname:

string emp_fname

emp_fname = Trim(sle_emp_fname.Text)

See also