Let's say I'm trying to sort the following array.
String[] array = { "ABC12", "ABC1", "ABC0" "ABC9"}
Sorting using Arrays.sort(array)
, it becomes {"ABC0", "ABC1", "ABC12", "ABC9"}
However, I want to sort alphabetically by letters AND numerically by numbers appending "ABC"
such that array
becomes {"ABC0", "ABC1", "ABC9", "ABC12"}
. Is there an existing method to do this?