RE: Faster List Checking
RE: Faster List Checking
- Subject: RE: Faster List Checking
- From: Jeffrey Mattox <email@hidden>
- Date: Thu, 29 May 2003 01:08:10 -0500
At 10:05 PM -0400 5/28/03, Ken Tozier wrote:
Since you're saving your "lists" as strings in the properties
"logolist" and "errorlist" you can eliminate looping entirely by
just changing AppleSctipt's text item delimiters to the info you are
searching for and count the resultant parts. If there's more than
one, the data was in the list.
For example:
set logolist to "joe, jill, jim, pete, bobo, etc..."
set AppleScript's text item delimiters to "jim, "
yeilds -> "joe, jill, " and "pete, bobo, etc..."
if (count text items of logolist > 1)
item was in list
else
item wasn't in list
end
--reset text item delimiters here
No looping necessary!
KT
But, it can give incorrect results:
set logolist to "joe, jill, jim, fred, bobo, john, "
set AppleScript's text item delimiters to "ed, "
(count text items of logolist) > 1
--> true
Fred ain't Ed.
Jeff
_______________________________________________
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.