ADD file via upload

杜韦注释
p2x9nfpei 4 months ago
parent 376e758b65
commit eda9a11aa0

@ -0,0 +1,31 @@
package com.utils;
// 字符串工具类,提供字符串判空相关方法
public class StringUtil {
// 判断字符串是否为空
// 空值条件null、空字符串或"null"字符串
public static boolean isEmpty(String s) {
// 检查字符串是否为null
if (s == null) {
return true;
}
// 检查字符串是否为空字符串
if (s.equals("")) {
return true;
}
// 检查字符串是否为"null"字符串
if (s.equals("null")) {
return true;
}
// 不满足以上条件则返回false
return false;
}
// 判断字符串是否非空
// 直接调用isEmpty方法取反
public static boolean isNotEmpty(String s) {
// 返回isEmpty方法的相反结果
return !StringUtil.isEmpty(s);
}
}
Loading…
Cancel
Save