LTRIM: Removing Blanks From the Left End of a String

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

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.

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.

RDIRECTOR has the director name right justified. LTRIM removes the leading blanks.

LTRIM(RDIRECTOR)

For                     BROOKS R. the result is BROOKS R.