Say I have
strings = {"a16", "b22", "a8", "c1", "b18", "b2", "a1"};
Sort@strings
gives {"a1", "a16", "a8", "b18", "b2", "b22", "c1"}
, but I'd like to obtain {"a1", "a8", "a16", "b2", "b18", "b22", "c1"}
. What's the shortes and most elegant way to do so? It could be done with StringSplit
, ToExpression
, Ordering
etc., but this all looks like an exaggeration; I expected MMA to have something like SortBy[strings,AlphaNumericalOrder]
...