• 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: How can I format an integer ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can I format an integer ?


  • Subject: Re: How can I format an integer ?
  • From: Luther Fuller <email@hidden>
  • Date: Sat, 25 Oct 2008 20:03:52 -0500

It must be getting too late. I escaped the repeat on mod not div.
Here is the correct code.

on format(nr, formatChar)
	set chunkList to {}
	repeat
		set chunk to text -1 thru -3 of ("000" & ((nr mod 1000) as integer))
		set chunkList to {chunk} & chunkList
		set nr to nr div 1000
		if nr = 0 then exit repeat
	end repeat
	set AppleScript's text item delimiters to {formatChar}
	return chunkList as text
end format ------------------

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: How can I format an integer ?
      • From: Philip Aker <email@hidden>
References: 
 >How can I format an integer ? (From: Emile SCHWARZ <email@hidden>)

  • Prev by Date: Re: How can I format an integer ?
  • Next by Date: Re: How can I format an integer ?
  • Previous by thread: Re: How can I format an integer ?
  • Next by thread: Re: How can I format an integer ?
  • Index(es):
    • Date
    • Thread