org.apache.commons.lang3.StringUtils类的2个方法区别
查看源码
//isEmpty
public static boolean isEmpty(final CharSequence cs) {
return cs == null || cs.length() == 0;
}
//isBlank
public static boolean isBlank(final CharSequence cs) {
int strLen;
if (cs == null || (strLen = cs.length()) == 0) {
return true;
}
for (int i = 0; i < strLen; i++) {
if (Character.isWhitespace(cs.charAt(i)) == false) {
return false;
}
}
return true;
}
总结
一般使用isBlank