FS#8314 - Natural numeric sorting
Opened by Nicolas Pennequin (nicolas_p) - Thursday, 13 December 2007, 16:48 GMT
Last edited by Thomas Martitz (kugel.) - Sunday, 01 March 2009, 18:12 GMT
This patch adds strnatcmp and strnatcasecmp, that are able to compare strings using natural numeric sorting. It also makes the trivial changes necessary to make use of this sorting in the file browser, without adding a setting.
This is very similar to
* It is not limited to leading numbers in a string
* It does not require a setting. strnatcmp and strnatcasecmp are drop-in replacements for strcmp and strcasecmp.
* It is much more generic and can be used anywhere else in the core. The file browser use is probably not the only place where we'd want to use natural sorting.
One thing that will be needed is to implement strnnatcmp and strnnatcasecmp.
This patch adds 628 bytes to a gigabeat build.
The code was written by Martin Pool and is available under the zlib license at http://sourcefrog.net/projects/natsort/
I found it and was inspired to port it to Rockbox thanks to http://www.codinghorror.com/blog/archives/001018.html
Sunday, 01 March 2009, 18:12 GMT
Reason for closing: Accepted
Additional comments about closing: Committed in r20155. Thank you very much!