Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sort file names func [duplicate]

I'm sorting strings that are comprised of text and numbers. I want the sort to sort the number parts as numbers, not alphanumeric.

For example I want: abc1def, ..., abc9def, abc10def

instead of: abc10def, abc1def, ..., abc9def

Does anyone know an algorithm for this (in particular in c++)

Thanks

like image 278
Will Avatar asked Nov 16 '22 10:11

Will


1 Answers

I asked this exact question (although in Java) and got pointed to http://www.davekoelle.com/alphanum.html which has an algorithm and implementations of it in many languages.

like image 54
Paul Tomblin Avatar answered Dec 21 '22 00:12

Paul Tomblin