Subject: | |
From: | |
Reply To: | |
Date: | Fri, 17 Nov 2006 15:32:10 -0800 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
On 11/17/06 3:27 PM, I wrote:
> On 11/17/06 3:08 PM, "Emmanuel" <[log in to unmask]> wrote:
>>
>> Here is the official version, where "tid" is a shortcut for "set
>> AppleScript's text item delimiters to". That's slightly different
>> from Deivy's method, which is excellent also.
>>
>> on IndexOfItem(theItem, theList)
>> set od to tid(return)
>> set theList to return & theList & return
>> tid(od)
>> try
>> -1 + (count paragraphs of (text 1 thru (offset of
>> (return & theItem & return) in theList) of theList))
>> on error
>> return 0
>> end try
>> end IndexOfItem
>
> Ooh, that looks great. (Particularly because, yes, there will be a unique
> instance in this list.) And very simple too. Also I'll already have it as
> return-delimited text to begin with.
>
> Thanks very much, Emmanuel. Very nice and straightforward.
Of course, I still have to run a repeat loop on every item of my short list3
to do this. Usually this list3 (the 'difference' of list1 and list2) really
will be very short, so that should be OK. But occasionally it might be very
large. The advantage of the Perl script I gave for getting the 'difference'
is that it can act on the entire list2 in one fell swoop.
>
> --
> Paul Berkowitz
>
--
Paul Berkowitz
|
|
|