It feels like this algorithm could be improved though. If a number has leading zeros you probably don't want to sort it numerically.
That said the author's situation where it's numerical and different lengths seems likely rare enough that it probably isn't worth complicating things.