Java implementation of Alpha-numeric comparator
ivan.gerasimov at oracle.com
Mon Dec 15 10:53:08 UTC 2014
In certain situations the preferred way of sorting strings is a
combination of char-comparing sorting with numeric sorting, where
List of strings sorted this way often look more natural to the human eyes:
Here's presented a sample implementation of the comparator, which
supports this way of sorting.
I placed it under src/sample directory.
MSDN provides the function StrCmpLogicalW(), which can be used for
similar sort order.
The differences are:
- case-sensitivity (StrCmpLogicalW is case-insensitive);
- treating leading zeroes;
- more accurate handling of strings with big numbers, which cannot be
converted to int/long.
I guess this comparator may become particularly useful when we'll have
'java10' and update releases/build numbers > 99 in the lists :)
I want to ask the community about how useful this comparator may be to you?
More information about the core-libs-dev