From: "Peña, Botp" Date: 2008-10-13T12:43:26+09:00 Subject: Re: Sorting help From: Binh Ly [mailto:binh@pigbaby.net] # 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". others have shown split+map you can also do it w the humble scanf (yes, like c's scanf) eg, a.sort_by{|x| x.scanf "%d.%d"} #=> ["7.4", "10.1", "10.9", "10.10", "10.11"]