Re: BIG number as string
Re: BIG number as string
- Subject: Re: BIG number as string
- From: Andy Wylie <email@hidden>
- Date: Wed, 18 Dec 2002 20:34:20 +1300
on Tue, 17 Dec 2002 17:05:21 -0500 Paul Skinner wrote:
>
on NumberToText(theNumber)
cool idea Paul, I pulled it apart to figger and lost some pieces...
on NumberToText(n)
tid("")
set _String to n as string
if _String contains "E" then
tid("E")
set _List to _String's text items
set _String to _List's item 1
set |+-?| to character 1 of item 2 of _List
set x to (characters 2 thru -1 of item 2 of _List) as string
tid(".")
set _List to _String's text items
tid("")
set _String to _List as string
if |+-?| = "+" then
return _String & _0(x)
else
return _0(x) & _String
end if
end if
return _String
end NumberToText
to _0(x)
set o to {}
repeat x times
set o's end to "0"
end repeat
o as string
end _0
on tid(x)
set AppleScript's text item delimiters to x
end tid
NumberToText(3.086358025E-9)
--> "0000000003086358025"
NumberToText(3.086358025E+9)
--> "3086358025000000000"
_____________________________ Andy
_______________________________________________
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.