Re: BIG number as string
Re: BIG number as string
- Subject: Re: BIG number as string
- From: Kai Edwards <email@hidden>
- Date: Thu, 19 Dec 2002 04:45:00 +0000
on 19/12/02 1:37 am, I wrote:
>
I'm on digests, so you may have already come back on this - but here's a quick
>
fix anyway (which may still include other warts):
Well it included at least one:
===============================
on numToTxt(n)
set {t, l} to {n as string, ""}
if "E" is not in t then return t
if t starts with "-" then set {l, t} to {"-", t's text 2 thru -1}
set {tid, text item delimiters} to {text item delimiters, "E"}
tell t's text items to set {i, d, s, x} to item 1's [NO BREAK]
{text 1 thru 1, text 3 thru -1} & item 2's {text 1 thru 1, text 2 thru -1}
set {text item delimiters, m, p, x, y, z} to {tid, s = "-", [NO BREAK]
(0.0 as string)'s text 2 thru 2, x as number, d's length, ""}
if m then
set {y, z} to {1, "0" & p}
if d = "0" then set d to ""
else if y > x then
tell x - y to set d to d's text 1 thru it & p & d's text (it + 1) thru -1
end if
repeat x - y times
set z to z & "0"
end repeat
if m then return l & z & i & d
l & i & d & z
end numToTxt
===============================
...and even if there ARE any more, I'm still going to bed now anyway...
--
Kai
_______________________________________________
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.