Is it really this hard to print currency values?

Dr. Hawkins dochawk at gmail.com
Sun Jul 29 19:20:28 EDT 2012


On Sunday, July 29, 2012, Robert Brenstein wrote:

> On 29.07.2012 at 9:05 Uhr -0700 Dr. Hawkins apparently wrote
>
> If you deal only with dollars, the issue is trivial. Things get quickly
> complicated if you deal with multiple currencies.
>

Trivial would be good :)

Yes, only dollars; this is for us bankruptcy filings, so it has no extra
national implication.

If I store In pennies . . .

(pull theVal from the db as an integer)

put (theVal<o) into isNeg
replace "-" with empty in theVal
if len(theVal) =1 then put 0 before theVal
put "." before char -2 of theVal
If len(theVal) >6  then put comma before char -6 of theVal
If len(theVal) > 10 then put comma before char -10 of theVal
If len(theVal) > 14 then put comma before char -14 of theVal
put "$" before theVal
If isNeg put "-" before theVal

but it sure seems clumsy, and that I should simply be able to put something
like

format("-$,#.00", theVal)
and let the engine handle it in a fraction of the time.



-- 
The Hawkins Law Firm
Richard E. Hawkins, Esq.
(702) 508-8462
HawkinsLawFirm at gmail.com
3025 S. Maryland Parkway
Suite A
Las Vegas, NV  89109



More information about the use-livecode mailing list