LTRIM( ) function

Returns a string with leading spaces removed from the input string.

Syntax

LTRIM(string)

Parameters

Name Type Description
string character The field, expression, or literal value to remove leading spaces from.

Output

Character.

Examples

Basic examples

Note that in both examples the trailing spaces are not removed by the LTRIM( ) function.

Returns "Vancouver   ":

LTRIM("   Vancouver   ")

Returns "New York   ":

LTRIM("   New York   ")

Advanced examples

Removing non-breaking spaces

Non-breaking spaces are not removed by the LTRIM( ) function.

If you need to remove leading non-breaking spaces, create a computed field using the following expression:

DEFINE FIELD Description_cleaned COMPUTED LTRIM(REPLACE(Description, CHR(160), CHR(32)))

The REPLACE( ) function replaces any non-breaking spaces with regular spaces, and then LTRIM( ) removes any leading regular spaces.

Remarks

How it works

The LTRIM( ) function removes leading spaces only. Spaces inside the string, and trailing spaces, are not removed.

Related functions

LTRIM( ) is related to the TRIM( ) function, which removes any trailing spaces from a string, and to the ALLTRIM( ) function, which removes both leading and trailing spaces.