• 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
Removing items from lists (again!)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Removing items from lists (again!)


  • Subject: Removing items from lists (again!)
  • From: Nigel Smith <email@hidden>
  • Date: Thu, 22 Feb 2001 18:47:53 +0000

Last week we had handlers for removing an item from a list. All
the"iteration"-style handlers started with "if the first item is..." and
then started moving through.

But it seems as though AS is quite happy trying to get item 0 of a list
(though it sensibly fails trying to get the (length + 1) item) -- at least
on my system/AS version.

So how about this... Does it work for other people, or is my machine a
one-off :-)
____________________
on stripList(aList, anItem)
repeat with x from 1 to ((length of aList) - 1)
if item x of aList = anItem then
set aList to (items 1 thru (x - 1) of aList) & --<linebreak>
(items (x + 1) thru (length of aList) of aList)
exit repeat
end if
end repeat
if last item of aList = anItem then
set aList to reverse of rest of reverse of aList
end if
return aList
end stripList
____________________

Thanks,

Nigel


  • Prev by Date: Mailto not working in 9.1?
  • Next by Date: Re: Mailto not working in 9.1?
  • Previous by thread: Re: Mailto not working in 9.1?
  • Next by thread: Re: Removing items from lists (again!)
  • Index(es):
    • Date
    • Thread