From: Matthew Moss Date: 2008-10-13T08:52:27+09:00 Subject: Re: Sorting help > I would like to request some helping with a sorting problem I have. > > Given an array with values like this ["10.1", "7.4", "10.9", "10.11", > "10.10"] > > when I sort it i get something like ["10.1", "10.10", "10.11", "10.9", > "7.4"] > > What is the best way to sort such an array of strings? > > What if the string was extended to "10.1.25". I might do something like this: arr.sort_by { |str| str.split('.').map { |x| x.to_i } }