How to implement a SQL like 'LIKE' operator in java?

后端 未结 15 1435
你的背包
你的背包 2020-11-29 03:12

I need a comparator in java which has the same semantics as the sql \'like\' operator. For example:

myComparator.like(\"digital\",\"%ital%\");
myComparator.l         


        
15条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-29 03:54

    The Comparator and Comparable interfaces are likely inapplicable here. They deal with sorting, and return integers of either sign, or 0. Your operation is about finding matches, and returning true/false. That's different.

提交回复
热议问题