| To: | REALbasic NUG <realbasic-nug@lists.realsoftware.com> |
|---|---|
| Subject: | Re: Removing Duplicates in an Array |
| From: | Arnaud Nicolet <anic297@mac.com> |
| Date: | Sat, 31 Jan 2009 21:29:25 +0100 |
| Authentication-results: | mx.google.com; spf=neutral (google.com: 74.124.194.228 is neither permitted nor denied by best guess record for domain of realbasic-nug-bounces@lists.realsoftware.com) smtp.mail=realbasic-nug-bounces@lists.realsoftware.com |
| Delivered-to: | listarchive@realsoftware.com |
| In-reply-to: | <2C751AB3-252D-4736-B9C3-BA6D1A82A5A8@oxalyn.com> |
| References: | <4984A232.70802@stny.rr.com> <2C751AB3-252D-4736-B9C3-BA6D1A82A5A8@oxalyn.com> |
| Reply-to: | REALbasic NUG <realbasic-nug@lists.realsoftware.com> |
| Sender: | realbasic-nug-bounces@lists.realsoftware.com |
Le 31 janv. 09 à 20:49 (soir), Eric M. Williams a écrit: On Jan 31, 2009, at 11:10 AM, Tom Russell wrote:I am trying to remove duplicates in an array but not sure how to handle once I get down to below 0. TheDocs is an array of strings.My code: dim i as Integer TheDocs.Sort for i = UBound(TheDocs) downto 0 if TheDocs(i) = TheDocs(i-1) then TheDocs.Remove i end if NextOnce i gets to 0 then it will throw an out of bounds exception and this is where I am not sure how to handle this.It would be faster (probably) to push them all into a dictionary, which will automatically remove duplicate Keys. I don't think all collections should be automatically used as dictionaries rather than array. If they are just plain data, an array is more suited. _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html> |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: Removing Duplicates in an Array, Arnaud Nicolet |
|---|---|
| Next by Date: | Subject: Re: Left, top vs X, Y in graphics, Jack Citron |
| Previous by Thread: | Re: Removing Duplicates in an Array, Eric M. Williams |
| Next by Thread: | Re: Removing Duplicates in an Array, Charles Yeomans |
| Indexes: | [Date] [Thread] [Top] [All Lists] |