isEmpty判断是否为空

来源:互联网 发布:网络语鹅是什么意思 编辑:程序博客网 时间:2024/06/05 11:22
public class IsEmpty {
public static boolean isEmpty(String input) {
if (input == null || "".equals(input)) {
return true;
}
for (int i = 0; i < input.length(); i++) {
char c = input.charAt(i);
if (c != ' ' && c != '\t' && c != '\r' && c != '\n') {
return false;
}
}
return true;
}
}