• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Check if it is a number
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Check if it is a number


  • Subject: Re: Check if it is a number
  • From: "Marc S.A. Glasgow" <email@hidden>
  • Date: Fri, 6 Dec 2002 01:18:58 -0500

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

on NumeralsOnly(n)
try
n as number
return not ((count of n) = 0 or n contains "-" or n contains "+")
on error
return false
end try
end NumeralsOnly
_______________________________________________
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.

  • Follow-Ups:
    • Re: Check if it is a number
      • From: Paul Skinner <email@hidden>
  • Prev by Date: Re: Lost dictionary
  • Next by Date: Re: Cloning Users
  • Previous by thread: Re: Check if it is a number
  • Next by thread: Re: Check if it is a number
  • Index(es):
    • Date
    • Thread