Re: find a list item
Re: find a list item
- Subject: Re: find a list item
- From: Yvan KOENIG <email@hidden>
- Date: Wed, 1 Apr 2009 19:10:35 +0200
Le 1 avr. 2009 à 18:17, Steve Thompson a écrit :
On 1 Apr 2009, at 16:34, Yvan KOENIG wrote:
Le 1 avr. 2009 à 17:03, Ronald Hofmann a écrit :
Hi,
I have a list with a few items and I want to find all items with
"iso"
My attempts do not work.
Any clues?
set theListe to {"Iso", "not", "Iso", "not", "Iso"}
get items in theListe where it contains "iso"
set theListe to {"Iso", "not", "Isocele", "not", "Isotope"}
set available to {}
repeat with i from 1 to count of theListe
if item i of theListe contains "Iso" then copy i to end of available
end repeat
available
Will return {1,3,5}. You need either
set theListe to {"Iso", "not", "Isocele", "not", "Isotope"}
set available to {}
repeat with anItem in theListe
if anItem contains "Iso" then copy anItem as string to end of
available
end repeat
or
set theListe to {"Iso", "not", "Isocele", "not", "Isotope"}
set available to {}
repeat with i from 1 to count of theListe
if item i of theListe contains "Iso" then copy item i of theListe
to end of available
end repeat
Steve
Given the original question, I was not sure if the OP wished to get
the values of the items or their index in the original list.
I choose to return the index.
Only the OP knows what he really wanted.
Yvan KOENIG (from FRANCE mercredi 1 avril 2009 19:10:33) _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden