Original post

This is an issue in programming when numbers are stored as strings – because as strings, when sorted alphabetically they will go by each digit, from first to last. You might encounter this problem when dealing with numbered file names, for example, which will be treated as strings but we might need to process them in order.
In our example below we use both the sort and strconv packages to sort the array and convert the strings to numbers within our comparison function.