Hi all, I have developped a File comparator to sort properly the files with a number in the name. For example, instead of sorting with the lexicographic order :

foo1.txt < foo10.txt < foo2.txt

it compares the numbers when the files share the same prefix and returns this order :

foo1.txt < foo2.txt < foo10.txt

This is how the "Sort by name" works in the Windows XP file explorer. Since it's quite low level I think it could be included in a commons project, but I'm not sure where:

- in [io] as a getComparator() method in FileUtils or as a FilenameComparator class ?

- in [lang] as a String comparator ?

- nowhere because this was already implemented in another well known project and I wasted my time reinventing the wheel ;)


Emmanuel Bourg


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to