• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Currency Numbers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Currency Numbers


  • Subject: Re: Currency Numbers
  • From: "Nigel Garvey" <email@hidden>
  • Date: Tue, 20 Jun 2006 03:35:41 +0100

kai wrote on Mon, 19 Jun 2006 19:16:06 +0100:

>on currency_format for v
>	set {s, d} to {(0 as real as text)'s character 2, (round (v mod 1 *
>100)) / 100 as string}
>	(v div 1 as text) & s & text 1 thru 2 of (d's text ((offset of s in
>d) + 1) thru -1 & "00")
>end currency_format
>
>currency_format for -123.4
>
>--> "-123,40" (* on a French system *)

OK. Bearing in mind Gary's historical treatise and kai's love of one-
liners, how about this?

  on currency_format for v
    tell (v mod 1 as string) * 100 to tell (it * it) ^ 0.5 to return (v
div 1 as string) & (0.0 as string)'s middle character & (it div 0.5 - it
div 1)
  end currency_format

  currency_format for -123.4

  --> "-123,40" (* on a French system *)

If I switch my machine over to French and French numbers, it's only in
strings that the decimal point is a comma. It still appears as a dot in
reals in Script Editor. Is that true for French users or have I missed
something?

NG

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Currency Numbers
      • From: kai <email@hidden>
    • Re: Currency Numbers
      • From: Yvan KOENIG <email@hidden>
  • Prev by Date: Re: Terminal & "sudo" with "password" & "with administrative privileges"
  • Next by Date: Re: Currency Numbers
  • Previous by thread: Re: Currency Numbers
  • Next by thread: Re: Currency Numbers
  • Index(es):
    • Date
    • Thread