Re: Check if it is a number
Re: Check if it is a number
- Subject: Re: Check if it is a number
- From: Paul Skinner <email@hidden>
- Date: Fri, 6 Dec 2002 08:49:08 -0500
On Friday, December 6, 2002, at 01:18 AM, Marc S.A. Glasgow wrote:
How about:
on NumeralsOnly(n)
try
return (0=n-n) as boolean
-- or return n if prefered
on error
return false as boolean
end try
end NumeralsOnly
I haven't speed checked it, but it seems simpler in executable steps
than the offered handler.
=-= Marc
It's faster by far in every test. But that's because it doesn't perform
the same function. If I follow it properly, it only tests to see if n
can be coerced to a number.
On Wednesday, November 27, 2002, at 05:19 PM, Thomas wrote:
Hi all, I have a string like this one "12A4B5" and I want to check for
each text item if this is a number and do something or if this not a
number and do another thing.
and then On Thursday, November 28, 2002, at 04:49 AM, christian vick
wrote:
'as number' is not reliable, since AS doesn't error on some charcters,
i.e. space, plus, minus. Not enough, this vary in different AS
versions.
And the OP indicated disallowing plus, minus and spaces was also
desired.
--
Paul Skinner
_______________________________________________
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.