Re: Faster List Checking
Re: Faster List Checking
- Subject: Re: Faster List Checking
- From: Paul Berkowitz <email@hidden>
- Date: Thu, 29 May 2003 01:13:05 -0700
On 5/28/03 11:08 PM, "Jeffrey Mattox" <email@hidden> wrote:
>
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.
set logolist to "joe, jill, jim, fred, bobo, john"
set logolist to " " & logolist & ","
set AppleScript's text item delimiters to " ed,"
(count text items of logolist) > 1
--> false
--
Paul Berkowitz
_______________________________________________
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.