From: "list. rb" Date: 2007-06-28T12:51:47+09:00 Subject: Re: Array Problem, sort Array ------=_Part_46077_9119648.1183002709794 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline w/ numbers also in case that's your next question :-) [1,2,4, nil,3,"a"].compact.collect {|i| i.to_s}.sort.uniq You should check out http://dev.rubycentral.com/ref/ref_c_array.html#sort On 6/27/07, list. rb wrote: > > ["a", "a", "a", "b", "b", "c", "c", "c","d", "d", "e", > nil].compact.uniq.sort > > On 6/27/07, Cool Wong wrote: > > > > List Rb wrote: > > > ["a", "a", "a", "b", "b", "c", "c", "c","d", "d", "e"].uniq.sort > > > > > > array = ["a", "a", "a", "b", "b", "c", "c", "c","d", "d", > "e"].uniq.sort > > > > > > puts array.join("WOOT!\n") > > > > if the array include the "nil", it cannot sort, why?? > > > > ["a", "a", "a", "b", "b", "c", "c", "c","d", "d", "e", nil].uniq.sort > > > > -- > > Posted via http://www.ruby-forum.com/. > > > > > ------=_Part_46077_9119648.1183002709794--