Remove trailing spaces from a character string

     TRIM(<cString>) --> cTrimString


     <cString> is the character string to be copied without trailing


     TRIM() returns a copy of <cString> with the trailing spaces removed.  If
     <cString> is a null string ("") or all spaces, TRIM() returns a null
     string ("").


     TRIM() is a character function that formats character strings.  It is
     useful when you want to delete trailing spaces while concatenating
     strings.  This is typically the case with database fields which are
     stored in fixed-width format.  For example, you can use TRIM() to
     concatenate first and last name fields to form a name string.

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


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


     .  This is a user-defined function in which TRIM() formats city,
        state, and zip code fields for labels or form letters:

        FUNCTION CityState(cCity, cState, cZip)
           RETURN TRIM(cCity) + ", " ;
            + TRIM(cState) + "  " + cZip

     .  In this example the user-defined function, CityState(),
        displays a record from Customer.dbf:

        USE Customer INDEX CustName NEW
        SEEK "Kate"

        ? CityState(City, State, ZipCode)
        // Result: Athens, GA 10066

 Files   Library is CLIPPER.LIB.

See Also: PAD() RTRIM() SUBSTR()

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.