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>str()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
STR()


Syntax:     STR(<expN1> [,<expN2> [,<expN3>]])

Purpose:    To convert a numeric expression to a character string.

Arguments:  <expN1> is the numeric expression to convert to a
            character string.

            <expN2> is the length of the character string to return
            including decimal digits, decimal point, and minus sign.

            <expN3> is the number of decimal places to return.

Returns:    A character string.

            If the optional length and decimal arguments are not
            specified, STR() returns the character string according to
            the following rules:


            Table: Results of STR() with No Optional Arguments
            ----------------------------------------------------------
               Expression              Return Value Length
            ----------------------------------------------------------
               Fields                  Field length plus decimals
               Expressions/constants   Min of 10 digits plus decimals
               VAL()                   Min of 3 digits
               MONTH()/DAY()           3 digits
               YEAR()                  5 digits
            ----------------------------------------------------------

Notes:      . If <expN2> is less than the number of whole number digits
              in <expN1>, STR() returns asterisks instead of the number.

            . If <expN2> is less than the number of decimal digits
              required for the decimal portion of the returned string,
              Clipper rounds the number to the available number of
              decimal places.

            . If <expN2> is specified, but <expN3> is omitted (no
              decimal places), the return value is rounded to an
              integer.

Library:    CLIPPER.LIB


----------------------------------- Examples -------------------------------

   number = 123.45
   ? STR(number)                 && Result:        123.45
   ? STR(number, 4)              && Result:  123
   ? STR(number, 2)              && Result: **
   ? STR(number, 0)              && Result: null string
   ? STR(number * 10, 7, 2)      && Result: 1234.50
   ? STR(number * 10, 12, 4)     && Result:    1234.5000


See Also: SUBSTR() VAL() StrZero()

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