• 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: Index from list
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Index from list


  • Subject: Re: Index from list
  • From: "Serge Belleudy-d'Espinose" <email@hidden>
  • Date: Mon, 19 Feb 2001 15:46:34 +0100

At 12:01 +0000 19/02/01, Pier Kuipers wrote:

>I am trying to find a "clean and quick" way to find out the index of
>any item in an unordered list with Vanilla Applescript. Below is the
>snippet that I've come up with:

If your list is only made of strings, there is a far faster alternative that was posted last week by some people including yours.

Check out the 'Two questions' thread.

Or, if you can't:

on remove_from_list(xItem, xList)

set {oldTID, AppleScript's text item delimiters} to \
{AppleScript's text item delimiters, return}

set xList to return & xList & return

set AppleScript's text item delimiters to return & xItem & return
set xList to xList's text items

set AppleScript's text item delimiters to return
set xList to ("" & xList)'s text items 2 thru -2

set AppleScript's text item delimiters to oldTID

return xList

end remove_from_list

(replace \ with continuation character)

Serge

__ __ __
_ \///\/ _ I N S T I T U T | Serge Belleudy-d'Espinose - IJM
\///\/// J A C Q U E S | 2 place Jussieu - 75251 Paris Cedex 05
_///\///\_ M O N O D | m@il : email@hidden
__/\///\__ Service Informatique | WWW : http://www.ijm.jussieu.fr/


References: 
 >Index from list (From: Pier Kuipers <email@hidden>)

  • Prev by Date: Re: Subject: Character mangling test
  • Next by Date: encoding with uuencode?
  • Previous by thread: Index from list
  • Next by thread: Re: Index from list
  • Index(es):
    • Date
    • Thread