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

Re: Find dups in list


  • Subject: Re: Find dups in list
  • From: Alex Zavatone <email@hidden>
  • Date: Tue, 04 Jan 2011 23:17:35 -0600

Here you go.

on run
set myList to {"a", "b", "c", "A"}
set myResult to FindDupsInList(myList)
end run

-- Alex Zavatone 2011
-- Case insensitive routine to find dup strings in list
on FindDupsInList(myList)
set myNewList to {}
set myDupsList to {}
repeat with myName in myList
-- the next line is REQUIRED or the comparison will fail
-- if you do not, then myName is a reference, not a string
set myName to myName as string
set myCondition to (myName is in myNewList)


if myCondition then
set the end of myDupsList to myName
else
set the end of myNewList to myName
end if
end repeat


return {myDupsList, myNewList}
end FindDupsInList
 _______________________________________________
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

References: 
 >Find dups in list (From: Alex Zavatone <email@hidden>)
 >Re: Find dups in list (From: Bruce Robertson <email@hidden>)

  • Prev by Date: Re: How to do silly with AppleScript?
  • Next by Date: Re: How to do silly with AppleScript?
  • Previous by thread: Re: Find dups in list
  • Next by thread: variables vrs properties
  • Index(es):
    • Date
    • Thread