LeftTrim

Description

Removes spaces from the beginning of a string.

Syntax

LeftTrim ( string {, removeallspaces } )

Argument

Description

string

The string you want returned with leading spaces deleted

removeallspaces

A boolean indicating that all types of spaces should be deleted


Return value

String.

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

Usage

If you do not include the optional removeallspaces argument or its value is false, only the space character (U+0020) is removed from the string.

If the removeallspaces argument is set to true, all types of space characters are removed.

This is a list of white spaces:

CHARACTER TABULATION (U+0009)

LINE FEED (U+000A)

LINE TABULATION (U+000B)

FORM FEED (U+000C)

CARRIAGE RETURN (U+000D)

SPACE (U+0020)

NO-BREAK SPACE (U+00A0)

EN QUAD (U+2000)

EM QUAD (U+2001)

EN SPACE (U+2002)

EM SPACE (U+2003)

THREE-PER-EM SPACE (U+2004)

FOUR-PER-EM SPACE (U+2005)

SIX-PER-EM SPACE (U+2006)

FIGURE SPACE (U+2007)

PUNCTUATION SPACE (U+2008)

THIN SPACE (U+2009)

HAIR SPACE (U+200A)

ZERO WIDTH SPACE (U+200B)

IDEOGRAPHIC SPACE (U+3000)

ZERO WIDTH NO-BREAK SPACE (U+FEFF)

Examples

This statement returns RUTH when the leading spaces are all space characters:

LeftTrim(" RUTH")

This statement returns RUTH when the leading spaces include other types of space characters such as tab characters:

LeftTrim(" RUTH", true)

These statements delete leading spaces from the text in the MultiLineEdit mle_name and store the result in emp_name:

string emp_name
emp_name = LeftTrim(mle_name.Text)

See also

RightTrim

Trim

LeftTrim method for DataWindows in the section called “LeftTrim” in DataWindow Reference.