/**
* 判断字符串满足指定格式 true 合法
*/
public static boolean checkValidity (String str, String regex) {
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(str);
if (m.matches()) {
return true;
} else {
return false;
}
}
版权声明:本文为u013967628原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。