• 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: getting the rank of an element of a list
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getting the rank of an element of a list


  • Subject: Re: getting the rank of an element of a list
  • From: Gary Lists <email@hidden>
  • Date: Sun, 27 Jul 2003 06:58:44 -0400

> On 7/27/03 1:38 AM, "Reinforced Darkness" <email@hidden> wrote:
>
>> Hi,
>> it's a newbie question but consider
>> //
>> set la_liste to {"a","b","c","d"}
>> get ???? of "b" in la_liste
>> //
>>
>> I've tried index, rank... doesn't work
>>
>> RD

On or about 7/27/03 4:55 AM, Andrew Oliver wrote:

> Standard AppleScript doesn't offer any way of doing this directly (which
> would explain why you're having trouble). You have to walk the list to find
> the match.

-- no OSAX method (maybe not the fastest for a very long list
set la_liste to {"a", "b", "c", "d"}
set la_lettre to "b"

repeat with dou from 1 to length of la_liste
if item dou of la_liste is la_lettre then return dou
end repeat

--> 2

HTH
--
Gary

MacOS 9.1 / "9 is Fine"
_______________________________________________
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.

References: 
 >Re: getting the rank of an element of a list (From: Andrew Oliver <email@hidden>)

  • Prev by Date: Re: getting the rank of an element of a list
  • Next by Date: Re: Disk Copy Script
  • Previous by thread: Re: getting the rank of an element of a list
  • Next by thread: RA connection was Re : no subject
  • Index(es):
    • Date
    • Thread