Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

ruby sort array numerically

a = ["teste", "test", "teste2", "tes3te", "10teste"]
a.sort_by! {|s| s[/d+/].to_i}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #ruby #sort #array #numerically
ADD COMMENT
Topic
Name
9+5 =