I need a comparator in java which has the same semantics as the sql 'like' operator.
For example:
myComparator.like("digital","%ital%");
myComparator.like("digital","%gi?a%");
myComparator.like("digital","digi%");
should evaluate to true, and
myComparator.like("digital","%cam%");
myComparator.like("digital","tal%");
should evaluate to false. Any ideas how to implement such a comparator or does anyone know an implementation with the same semantics? Can this be done using a regular expression?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…