How I can sort array data alphanumerically in ruby?
Suppose my array is a = [test_0_1, test_0_2, test_0_3, test_0_4, test_0_5, test_0_6, test_0_7, test_0_8, te
From the looks of it, you want to use the sort function and/or the reverse function.
ruby-1.9.2-p136 :009 > a = ["abc_1", "abc_11", "abc_2", "abc_3", "abc_22"]
=> ["abc_1", "abc_11", "abc_2", "abc_3", "abc_22"]
ruby-1.9.2-p136 :010 > a.sort
=> ["abc_1", "abc_11", "abc_2", "abc_22", "abc_3"]
ruby-1.9.2-p136 :011 > a.sort.reverse
=> ["abc_3", "abc_22", "abc_2", "abc_11", "abc_1"]