• 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: numbers in a variable.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: numbers in a variable.


  • Subject: Re: numbers in a variable.
  • From: David Durkee <email@hidden>
  • Date: Thu, 31 Jul 2003 13:54:54 -0500

set thetext to "3 Canon color"
set thewords to every word in thetext
set numberfound to false
repeat with aword in thewords
try
aword as number
set numberfound to true -- this line will be skipped if the previous line returns an error
end try
end repeat
return numberfound


On Thursday, July 31, 2003, at 12:58 PM, Ruby Madraswala wrote:

How do I check if a variable contains numbers (can range from 1 to 99)? I tried:
If newword contains [1-99] then
Do something
Else
It's a heading
End if

I don't get any error message and "do something" does not work which right now is just few display statements.

Example:
Printers
1 HP laserjet
2 HP inkjet
3 Canon color
Plotters
4 xerox
5 oce
and so on.

Thanks in advance.
Ruby
_______________________________________________
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.


--
David Durkee
email@hidden
<http://ddurkee.homeip.net/>
_______________________________________________
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.

  • Prev by Date: Re: ASS 1.2, the Mail Search application, wiring up the datasouce
  • Next by Date: Re: numbers in a variable.
  • Previous by thread: numbers in a variable.
  • Next by thread: Re: numbers in a variable.
  • Index(es):
    • Date
    • Thread