Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!uunet!amusing!lordbah From: lordbah@amusing.UUCP (Jeff Van Epps) Newsgroups: comp.lang.rexx Subject: Dollarizing Message-ID: Date: 27 Apr 91 18:54:12 GMT Followup-To: comp.lang.rexx Organization: Amusing Software Lines: 31 What's an easier way to do this? 6 -> 6.00 6.2 -> 6.20 6.2324323 -> 6.23 i.e. fixed at two decimal places. /* * Format a number as a $$ value, with 2 digits after the decimal point. */ dollarize: procedure arg n dlen = index(n,'.') if dlen = 0 then do str = n || '.00' end else do n = left(n,20,'0') /* lots of 0's after decimal */ cents = right(left(n,dlen+2),2) str = left(n,dlen) || cents end return str Looking at this, I see that it won't round the number either. Bah. -------------------------------------------------------------------- Jeff Van Epps uunet!amusing!lordbah