Remove leading and trailing spaces from a character string

     ALLTRIM(<cString>) --> cTrimString


     <cString> is the character expression to be trimmed.


     ALLTRIM() returns a character string with leading and trailing spaces


     ALLTRIM() is a character function that removes both leading and trailing
     spaces from a string.  It is related to LTRIM() and RTRIM() which remove
     leading and trailing spaces, respectively.  The inverse of ALLTRIM(),
     LTRIM(), and RTRIM() are the PADC(), PADL(), and PADR() functions which
     center, left-justify, or right-justify character strings by padding them
     with fill characters.


     .  Space characters:  The ALLTRIM() function treats carriage
        returns, line feeds, and tabs as space characters and removes these
        as well.


     .  This example creates a string with both leading and trailing
        spaces, and then trims them with ALLTRIM():

        cString := SPACE(10) + "string" + SPACE(10)
        ? LEN(cString)                     // Result: 26
        ? LEN(ALLTRIM(cString))            // Result: 6

 Files   Library is EXTEND.LIB.

See Also: LTRIM() PAD() RTRIM() TRIM()


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.