Re: BIG number as string
Re: BIG number as string
- Subject: Re: BIG number as string
- From: Paul Skinner <email@hidden>
- Date: Tue, 17 Dec 2002 17:05:21 -0500
on NumberToText(theNumber)
set AppleScript's text item delimiters to ""
set the theNumberAsText to theNumber as text
if the theNumberAsText contains "E" then
set AppleScript's text item delimiters to "E"
set the theNumberAsText to every text item of theNumberAsText
set AppleScript's text item delimiters to ""
set theNumberString to item 1 of theNumberAsText
set theSign to character 1 of item 2 of theNumberAsText
set thePower to (characters 2 thru -1 of item 2 of theNumberAsText)
as text
set AppleScript's text item delimiters to "."
set theValue to every text item of theNumberString
set AppleScript's text item delimiters to ""
set theValue to theValue as text
if theSign is "+" then
set zeroes to ""
set valLength to (length of theValue) - 1
repeat (thePower - valLength) times
set zeroes to zeroes & "0"
end repeat
set theValue to theValue & zeroes
set theConvertedNumber to (characters 1 thru (thePower + 1) of
theValue) as text
try
set theConvertedNumber to theConvertedNumber & "." & (characters
(thePower + 2) thru length of theValue) as text
end try
else
set zeroes to ""
repeat thePower - 1 times
set zeroes to zeroes & "0"
end repeat
set theConvertedNumber to zeroes & theValue
end if
--repeat
else
return theNumber
end if
return theConvertedNumber
end NumberToText
--
Paul Skinner
On Tuesday, December 17, 2002, at 05:51 PM, julifos wrote:
Hi all...
I'd like retrieve a string from a big-numbers-calculation, but I can't
:-(
Eg, I'd like this:
55555 * 55555
--> 3086358025
--> rather than 3.086358025E+9
(seems it works when displaying it in a dialog...)
display dialog result
JJ
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.