日期:2014-05-20  浏览次数:20662 次

求一个大小写不敏感匹配方法(要求极端高效)
我写了个低效的.
public static boolean isMatch (String input, String checkKey) {

boolean result = false;
if (input.equals(checkKey) || input.toLowerCase().equals(checkKey.toLowerCase())) {
result = true;
}
return result;
}

toLowerCase这个方式太低效. 我见过C++处理这类问题有一些高效方式. java 有吗? 或者说java的toLowerCase 已经是被封装过的最高效的方式了?

------解决方案--------------------
input.equalsIgnoreCase(checkKey) ,返回true或false
比你那个高效多了
------解决方案--------------------
楼上正解
------解决方案--------------------
2楼正解