Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Currency Numbers [2]



Oops! I left out the code to resolve the digits to the right of the decimal point:

set theRslt to (display dialog "Enter a number" default answer "")
try
set theNmbr to (text returned of theRslt) as number
on error
display dialog "That's not a number" buttons {"Cancel"}
end try
set theNmbr to (round (theNmbr * 100) rounding as taught in school) / 100 as text
log theNmbr
set {AppleScript's text item delimiters, od} to ¬
{".", AppleScript's text item delimiters}
set theNmbr to text items of theNmbr
set cCnt to length of item 2 of theNmbr
set theNmbr to theNmbr as text
set {AppleScript's text item delimiters} to od
if cCnt < 2 then
set theNmbr to theNmbr & "0"
end if
theNmbr


Marc [6/19/2006  4:46:33 PM]

On Jun 19, 2006, at 15:55:44 +0100, David Bradley wrote:
Date: Mon, 19 Jun 2006 15:55:44 +0100
From: David Bradley <email@hidden>
Subject: Currency Numbers
To: applescript users <email@hidden>

Hi,

Can you format numbers to 2 decimal points in Applescript. I want to
format the numbers in to a currency format

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

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.