/**
* 验证电话号码,正确格式为:"XXX-XXXXXXX"、"XXXX-XXXXXXXX"、""XXXX-XXXXXXX"、XXX-XXXXXXX"、
* "XXX-XXXXXXXX"、"XXXXXXX"和"XXXXXXXX"
*
* @param str
* @return
*/
public static boolean IsTel(String str) {
String reg = "^(\\d{3,4}-)?\\d{7,8}$";
return getRegResult(str, reg);
}
/**
* 验证手机号码
*
* @param str
* @return
*/
public static boolean IsPhone(String str) {
String reg = "^(13|18|14|17|15)\\d{9}$";
return getRegResult(str, reg);
}
* 验证电话号码,正确格式为:"XXX-XXXXXXX"、"XXXX-XXXXXXXX"、""XXXX-XXXXXXX"、XXX-XXXXXXX"、
* "XXX-XXXXXXXX"、"XXXXXXX"和"XXXXXXXX"
*
* @param str
* @return
*/
public static boolean IsTel(String str) {
String reg = "^(\\d{3,4}-)?\\d{7,8}$";
return getRegResult(str, reg);
}
/**
* 验证手机号码
*
* @param str
* @return
*/
public static boolean IsPhone(String str) {
String reg = "^(13|18|14|17|15)\\d{9}$";
return getRegResult(str, reg);
}