Excel导入,校验商品条码长度为4到40位

This commit is contained in:
季圣华
2023-03-01 23:14:42 +08:00
parent d2e56aa3ae
commit 4bbce58f3f
3 changed files with 33 additions and 11 deletions

View File

@@ -317,6 +317,28 @@ public class StringUtil {
}
}
/**
* 校验条码长度为4到40位
* @param value
* @return
*/
public static boolean checkBarCodeLength(Object value) {
if(value!=null) {
String str = value.toString();
if(isNotEmpty(str)) {
if(str.length()>=4 && str.length()<=40 ) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
/**
* 判断对象是否为数字(含小数)
* @param str