From: Yossef Mendelssohn Date: 2009-03-28T11:31:34+09:00 Subject: Re: Sorting decimal index numbers? On Mar 27, 9:18 pm, Aaron Vegh wrote: > When the index numbers are float or strings, they sort like this. But I > want "1.10" to be the last number. Any idea how to put these guys in the > right order? $ irb >> nums = ['1.1', '1.2', '1.10', '1.9'] => ["1.1", "1.2", "1.10", "1.9"] >> nums.sort => ["1.1", "1.10", "1.2", "1.9"] >> nums.collect { |n| n.split('.').collect { |i| i.to_i } }.sort.collect { |n| n.join('.') } => ["1.1", "1.2", "1.9", "1.10"] -- -yossef