com.generationjava.compare
Class NumericStringComparator
java.lang.Object
com.generationjava.compare.NumericStringComparator
- All Implemented Interfaces:
- Comparator
- public class NumericStringComparator
- extends Object
- implements Comparator
A Comparator which deals with alphabet characters 'naturally', but
deals with numerics numerically. Leading 0's are ignored numerically,
but do come into play if the number is equal. Thus aaa119yyyy comes before
aaa0119xxxx regardless of x or y.
The comparison should be very performant as it only ever deals with
issues at a character level and never tries to consider the
numerics as numbers.
- Author:
- bayard@generationjava.com
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NumericStringComparator
public NumericStringComparator()
compare
public int compare(Object o1,
Object o2)
- Specified by:
compare in interface Comparator
countZeroes
public int countZeroes(String str)
Copyright © 2000-2005 OSJava. All Rights Reserved.