Is it really this hard to print currency values?

Mike Bonner bonnmike at gmail.com
Sun Jul 29 19:42:30 EDT 2012


Try this in a button.

on mouseUp
   put "result = FormatCurrency(25432)" into tScript
   do tScript as vbscript
   put the result
end mouseUp

As long as your system region settings are what you expect you should get
$25,432.00 in the message box.

Of course if vbscript is broken (how likely is that *coughWINDOWS*) then
your customer won't be happy.
And of course you'd have to use applescript on mac, and on ios/android
dunno. Probably wouldn't be bad to make an ios external to do this using
the devices locale, no sdk for android yet of course.  But if all you need
is windows support, (or mac/applescript support) it might be good enough
for your needs.

On Sun, Jul 29, 2012 at 5:20 PM, Dr. Hawkins <dochawk at gmail.com> wrote:

> 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
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list