java判断该手机号码是否是移动手机号段
2009-04-23 20:54:47 来源:WEB开发网 /**
* 判断该手机号码是否是移动手机号段<br>
*
* @param phone
* @return true or false
* @throws Exception
*/
PRivate boolean isMobileNumber(String phone) throws ServiceException {
boolean isExist = false;
phone = phone.trim();
if (phone == null || phone.length() < 7) {
try {
throw new Exception("wrong phone length");
} catch (Exception ex) {
ex.printStackTrace();
}
}
String code = phone.substring(0, 7);// 暂时保留2009-01-16 16:30
if (code.startsWith("134") || code.startsWith("135")
|| code.startsWith("136") || code.startsWith("137")
|| code.startsWith("138") || code.startsWith("139")
|| code.startsWith("159") || code.startsWith("158")
|| code.startsWith("150") || code.startsWith("157")
|| code.startsWith("151") || code.startsWith("188")
|| code.startsWith("189")) {
isExist = true;
}
return isExist;
}
更多精彩
赞助商链接