Possible Duplicate:
Natural sort in C - “array of strings, containing numbers and letters”
When sorting strings in C with qsort and strcmp I have the problem that alphanumeric entries, typically strings ending with numbers, are being sorted oddly like this:
The desired behavior is this:
What is the easiest way to do this?
Thanks
There's nothing odd about the sort; '1' comes before '2', so any string that has 'Entry1' will come before any string that has 'Entry2'. That's just the way strcmp is defined. If you desire a different sort order, you can always write a different sort function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With