From: Stuart Little Date: 2009-02-12T07:18:07+09:00 Subject: Re: Array uniq Ok This dateCheck = [time.gsub(/\s/, '')[0..7] + time[26..29]] #printdata.push(dateCheck) @alerts.push dateCheck gets me: TueAug052008 TueAug052008 TueAug052008 WedAug062008 WedAug062008 TueAug052008 and this dateCheck = [time.gsub(/\s/, '')[0..7] + time[26..29]] #printdata.push(dateCheck) @alerts.push dateCheck.uniq gets me TueAug052008 TueAug052008 TueAug052008 WedAug062008 WedAug062008 TueAug052008 Same data for both. When I do uniq! I get nothing Many thanks Pit Capitain wrote: > 2009/2/11 Stuart Little : >> 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. >> >> 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 > > Can you show us the contents of the array and the result of #uniq? For > example: > > my_array = > > p my_array > p my_array.uniq > > Regards, > Pit -- Posted via http://www.ruby-forum.com/.