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

Re: Removing items from lists


  • Subject: Re: Removing items from lists
  • From: Ben Waldie <email@hidden>
  • Date: Sun, 6 Oct 2002 11:11:20 -0400

On Sunday, October 6, 2002, at 10:16 AM, Goldfish wrote:

> What would be the correct syntax for removing an item from a list?
>
> e.g. set x to every item of {"the","quick","brown","fox"} except
> "quick"
>
> Any ideas?

Try this...

set itemToRemove to "quick"
set theList to {"the", "quick", "brown", "fox"}
set theNewList to {}
repeat with a from 1 to (count theList)
set cItem to item a of theList
if cItem !A itemToRemove then set end of theNewList to cItem
end repeat
return theNewList

- Ben

Benjamin S. Waldie
AppleScript Guru

http://www.applescriptguru.com
http://www.wtmedia.com
_______________________________________________
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: 
 >Removing items from lists (From: Goldfish <email@hidden>)

  • Prev by Date: Removing items from lists
  • Next by Date: Re: Removing items from lists
  • Previous by thread: Removing items from lists
  • Next by thread: Re: Removing items from lists
  • Index(es):
    • Date
    • Thread