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>currency() numeric to dollar format apndxj.prg</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Currency()     Numeric to dollar format                Apndxj.prg


Syntax:        Currency(<expN>)

Argument:      <expN> is a numeric value with up to 12 whole number
               digits to convert to a character string formatted as
               dollars.

Returns:       A character string formatted as money with embedded
               commas, two decimal places, and a floating dollar sign.
               Leading blanks are preserved.


--------------------------------- Source Code ------------------------------

   FUNCTION Currency
   PARAMETERS num_val
   PRIVATE outstr

   outstr = LTRIM(TRANSFORM(num_val, "999,999,999,999.99"))

   RETURN (SPACE(LEN(STR(num_val)) - LEN(outstr) + 1) + "$" + outstr)

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