• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Find index of list to find item in another list
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Find index of list to find item in another list


  • Subject: Re: Find index of list to find item in another list
  • From: Yvan KOENIG <email@hidden>
  • Date: Wed, 1 Jul 2009 22:02:00 +0200


Well Jim,
You could have used just plain AppleScript without going through so many hoops.




set X to {"123456", "123457", "123458"}
set Y to {{"A", "B", "C"}, {"D"}, {"E", "F"}}

-- the item I'm looking for
set Z to "123457"



if X contains Z then set theindex to getitemindex(X, Z)
---->2


on getitemindex(thelist, theitem)
set AppleScript's text item delimiters to return
set thelist to thelist as text
return count of paragraphs in (text 1 thru (get offset of theitem in thelist) of thelist)
end getitemindex




And what if Y's items contains strings with embedded return characters ?

Yvan KOENIG (from FRANCE mercredi 1 juillet 2009 22:01:53)



_______________________________________________
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
  • Follow-Ups:
    • Re: Find index of list to find item in another list
      • From: Deivy Petrescu <email@hidden>
References: 
 >Re: Find index of list to find item in another list (From: Jim Skibbie <email@hidden>)
 >Re: Find index of list to find item in another list (From: Deivy Petrescu <email@hidden>)

  • Prev by Date: Re: Find index of list to find item in another list
  • Next by Date: Re: Find index of list to find item in another list
  • Previous by thread: Re: Find index of list to find item in another list
  • Next by thread: Re: Find index of list to find item in another list
  • Index(es):
    • Date
    • Thread