From: Rick DeNatale Date: 2009-02-12T07:01:07+09:00 Subject: Re: Array uniq --00163646d566a37a540462abc1a2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Wed, Feb 11, 2009 at 4:51 PM, Stuart Little < stuart_clarke1986@hotmail.co.uk> wrote: > I want something simpler than that to be honest. I just want to get rid > of all duplicate entries in the data set and leave just one of each > unique value in my array. I guess you are replying to me. Perhaps it would be best not to cut everything in the reply. > > > Also, FYI .uniq returns all the values as they are and doesn't remove > duplicates. .uniq! gets rid of all the values and leaves me with no data > at all > No, I know exactly what Array#uniq! does: ------------------------------------------------------------ Array#uniq! array.uniq! -> array or nil ------------------------------------------------------------------------ Removes duplicate elements from self. Returns nil if no changes are made (that is, no duplicates are found). a = [ "a", "a", "b", "b", "c" ] a.uniq! #=> ["a", "b", "c"] b = [ "a", "b", "c" ] b.uniq! #=> nil As I said I wasn't sure what you were trying to accomplish and what object should eliminate duplicates. If you think about my example a bit, I suspect you'll be able to suss it out. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale --00163646d566a37a540462abc1a2--