LTRIM: Removing Blanks From the Left End of a String

How to:

The LTRIM function removes all blanks from the left end of a string.

Syntax: How to Remove Blanks From the Left End of a String

LTRIM(string)

where:

string

Alphanumeric

Is the string to trim on the left.

The data type of the returned string is AnV, with the same maximum length as the source string.

Example: Removing Blanks From the Left End of a String

In the following request against the MOVIES data source, the DIRECTOR field is right-justified and stored in the RDIRECTOR virtual field. Then LTRIM removes leading blanks from the RDIRECTOR field:

DEFINE FILE MOVIES
RDIRECTOR/A17 = RJUST(17, DIRECTOR, 'A17');
 END
TABLE FILE MOVIES
PRINT RDIRECTOR AND
COMPUTE
TRIMDIR/A17 = LTRIM(RDIRECTOR);
WHERE DIRECTOR CONTAINS 'BR'
ON TABLE SET PAGE NOPAGE
END

The output is:

  RDIRECTOR          TRIMDIR
  ---------          -------
        ABRAHAMS J.  ABRAHAMS J.
          BROOKS R.  BROOKS R.
        BROOKS J.L.  BROOKS J.L.