Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide To Clipper - <b>trim()/rtrim()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
TRIM()/RTRIM()


Syntax:     TRIM(<expC>)/RTRIM(<expC>)

Purpose:    To remove trailing spaces from the result of a character
            expression.

Argument:   <expC> is the character string to remove the trailing
            spaces from.

Returns:    A character string.

Usage:      TRIM() is useful when you want to delete trailing spaces
            from a character string when concatenating with another
            string.  For example, a typical application of TRIM() is the
            creation of formatted strings for names and addresses.

            ? TRIM(First) + IF(EMPTY(Mi), " ", Mi + ". ") +;
               Last
            ? TRIM(City) + ", " + TRIM(State) + "  " +;
               Zipcode

            Test for null strings: You can use TRIM() as part of an
            expression to test for an empty character string.  For
            example, you can use the condition, LEN(TRIM(<expC>)) = 0 or
            the more preferred method, EMPTY(<expC>).

Library:    CLIPPER.LIB


----------------------------------- Example --------------------------------

   string = "12345   "
   ? LEN(TRIM(string))              && Result: 5
   *
   string = SPACE(5)
   ? LEN(TRIM(string))              && Result: 0


See Also: LTRIM() SUBSTR()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson