标签:void style static rgs null bool equals 校验 trim
code:
/** * 多参数非空校验 * * @param params * @return */ public static boolean nullOrEmpty(String... params) { if (params != null) { for (String param : params) { if (param == null || "".equals(param.trim())) { return true; } } } return false; }
test:
public static void main(String[] args) { boolean rev = nullOrEmpty("name", null); System.out.println(rev);// false rev = nullOrEmpty("name", ""); System.out.println(rev);// false rev = nullOrEmpty("name", "name-col1"); System.out.println(rev);// true }
标签:void style static rgs null bool equals 校验 trim
原文地址:https://www.cnblogs.com/huakaiyoushi/p/11250004.html