• 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: International number formats
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: International number formats


  • Subject: Re: International number formats
  • From: yvan-koenig <email@hidden>
  • Date: Fri, 25 Feb 2005 14:26:37 +0100

Hello

As a french user, even if the dot is not the official character used as column separator (here it is the space), I often use this simple piece of code:


property separateurDecimal : "" -- globale

on run


	set separateurDecimal to character 2 of (0.1 as text)
	(* prépare la gestion des nombres *)
	set n1 to (my normalise("1 234,56")) as number
	display dialog "" & n1
end run

-- ==================

on normalise(a)
	if separateurDecimal is "," then
		if a contains "." then set a to my chercheRemplace(a, ".", "")
	else
		if a contains "," then set a to my chercheRemplace(a, ",", "")
	end if
	if a contains " " then set a to my chercheRemplace(a, " ", "")
	return a
end normalise

-- ==================

on chercheRemplace(t, TID1, TID2)
	set AppleScript's text item delimiters to TID1
	set L to (text items of t)
	set AppleScript's text item delimiters to TID2
	set t to L as text
	set AppleScript's text item delimiters to ""
	return t
end chercheRemplace

-- ==================

Yvan KOENIG

_______________________________________________
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


References: 
 >International number formats (From: Brennan <email@hidden>)
 >Re: International number formats (From: Bernardo Hoehl <email@hidden>)

  • Prev by Date: Re: International number formats
  • Next by Date: Re: International number formats
  • Previous by thread: Re: International number formats
  • Next by thread: Re: International number formats
  • Index(es):
    • Date
    • Thread