I offered one of those to Collections a while back but it was turned
down as it chose one specific way to do the ordering:

http://www.osjava.org/genjava/multiproject/gj-core/xref/com/generationjava/compare/NumericStringComparator.html

For your submission, I think as a comparator of Strings to Collections
makes the most sense as it deals with java.util.Comparator and Lang
doesn't.

Anything in my class is up for grabs if you want any of it :)

Hen

On Wed, 05 Jan 2005 01:13:13 +0100, Emmanuel Bourg <[EMAIL PROTECTED]> wrote:
> 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]
> 
>

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

Reply via email to