Ruby will Array#sortby default sort numbers like this in the order of their value:
[11, 12, 13, 112, 113, 124, 125, 127]
I would like to sort an array of numbers like this, as if they were in alphabetical order:
[11, 112, 113, 12, 124, 125, 127, 13]
How can i do this? (Ultimately, I want to do this with Hash keys, so if you want to answer that way, that's fine.) Also, is there a name for this sort type?
source
share