Answers for "sort the array elements in ascending order without using method in ruby"

0

ruby sort array numerically

a.sort_by(&:to_i)
Posted by: Guest on December-15-2020
0

ruby sort array numerically

a = ["teste", "test", "teste2", "tes3te", "10teste"]
a.sort_by! {|s| s[/\d+/].to_i}
Posted by: Guest on December-15-2020

Code answers related to "sort the array elements in ascending order without using method in ruby"

Browse Popular Code Answers by Language