I need to sort an array of alphanumerical items as follows. From:
2 xxx
20 axxx
38 xxxx
20 bx
8540 xxxxxx
to:
8540 xxxxx
38 xxxx
20 axxx
20 bx
2 xxx
Thus, sorted descending with respect to the numbers, then ascending alphabetically. The numbers are always separated from the alphabetical characters (denoted "xxxx") by a single space, but the numbers are variable length.
I suspect I need to use some Regex in the sort() function and splitting off the numbers by the space then sorting it, but I don't know how to tie in the alphabetical sorting. Any code samples? Thanks so much!