Re: "+" and "-" are numbers.
Re: "+" and "-" are numbers.
- Subject: Re: "+" and "-" are numbers.
- From: Andy Wylie <email@hidden>
- Date: Mon, 05 Aug 2002 19:22:52 +1200
on 5/8/02 3:29 AM +1200: Paul Skinner wrote:
>
On Sunday, August 4, 2002, at 10:38 AM, Arthur J. Knapp wrote:
>
>
>> Date: Fri, 2 Aug 2002 16:33:28 -0400
>
>> Subject: Re: "+" and "-" are numbers.
>
>> From: Paul Skinner <email@hidden>
>
>
>
>> On Friday, August 2, 2002, at 01:42 PM, Arthur J. Knapp wrote:
>
>>> P.S. If someone asked Nigel Garvey very politely, he could probably
>
>>> come up with a much nicer and robust number parsing routine. :)
>
>
>
>
>
>> I'll take a crack at it myself. But if anyone can improve on it please
>
>> do...
>
>
>
>> on NumbersOfText(x)
>
>
>
> Very nice :)
>
>
>
>
<blush> ; )
>
>
Oops! I missed some signs on negative numbers following other numbers as
>
well as not handling Es in number runs that were not part of an
>
exponential notation number.
>
I couldn't help myself...
set a to "-.0002AB123CDEFdsg2.2..2....kaSabc1.0E+9de
fui7yE38.9-57ehwt704.599.8675-460jfdU()*7rQEIOW5
HJ8+90Q790sdeE-8TR9WE-5UTGEJ1234E5678909VG90SD3895UJ3K"'s text items
set bag to {}
set wannabees to {".", "*"}
set f to false
considering case
repeat with n from 1 to count a
set x to a's item n
try
x as number
set end of bag to x
set f to false
on error number n
if n = -1700 then
if x is in wannabees then
set end of bag to x
else if f = false then
if x = "E" then
set end of bag to x
else
set end of bag to return
set f to true
end if
end if
end if
end try
end repeat
end considering
bag as string
_____________________________ Nigel Wannabe
_______________________________________________
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.