Please tell me about these long numbers. Do you get them from the number 12? Would they work for varying numbers? Say, anywhere from 1 thru 150?
Regarding example text "I am 12": The first "word" is roman number one, two or three ("I", "II" or "III") The second "word" is always an english word and the third "word", in this case, is always an arabic number, which may vary up to 150. This is not someone's age as someone commented earlier. Sorry to confuse the issue.
Thanks again for the suggestions.
-Daniel
On May 7, 2012, at 3:27PM, Emmanuel LEVY wrote: A slightly faster version maybe, just in case:
set _selection to "I am 12"
if (word 1 of _selection is "I") and (word 3 of _selection is in "1092111201029384756657483930119110118100827364554637281171089901161079806253443526115106978870114105960423324113104958677685010394022") then say "contains a number" using "Bruce" else say "contains no numbers" using "Victoria" end if
Emmanuel
On May 7, 2012, at 5:55 PM, Nigel Garvey wrote:
Michelle Steiner wrote on Sun, 06 May 2012 21:05:52 -0700:
set _selection to "I am 12"
if word 1 of _selection is "I" then
try
word 3 of _selection as number
say "contains a number" using "Bruce"
on error
say "contains no numbers" using "Victoria"
end try
end if
If one assumes a maximum age of, say, 120, this is slightly faster: ;)
set _selection to "I am 12"
if (word 1 of _selection is "I") and (word 3 of _selection is in "120119118117116115114113112111010910810710610510410310210099989796959493929088878685848382807776757473727066656463626055545352504443424033323022") then
say "contains a number" using "Bruce"
else
say "contains no numbers" using "Victoria"
end if
NG
|