public class checkParams {
//非空校验
public static boolean checkString(String ... params) {
boolean boo=true;
if(params ==null||"".equals(params)) {
return false;
}
for (int i = 0; i < params.length; i++) {
if(params[i]==null||"".equals(params[i])) {
boo=false;
}
}
return boo;
}
public static void main(String[] args) {
//false
boolean boo0 = checkParams.checkString("");
//false
boolean boo1 = checkParams.checkString("","1");
//false
boolean boo2 = checkParams.checkString(null,"1");
//true
boolean boo3 = checkParams.checkString("2","1");
}
}
校验Sring非空简易方法
猜你喜欢
转载自blog.csdn.net/qq_39706570/article/details/104000265
今日推荐
周排行