List of utility methods to do Phone Number Check
boolean | isPhoneNumber(String inputStr) is Phone Number if (inputStr == null) { return false; if (inputStr.startsWith("1") && inputStr.length() == 11) { return true; return false; |
boolean | isPhone(String phoneNumber) is Phone String strPattern = "([0-9]{3,4}-)?[0-9]{4,12}"; Pattern p = Pattern.compile(strPattern); Matcher m = p.matcher(phoneNumber); return m.matches(); |
boolean | isPhoneNumber(final String phone) is Phone Number Pattern pattern = Pattern.compile(telNumRegex);
Matcher macther = pattern.matcher(phone.trim());
return macther.find() ? true : false;
|
boolean | isTelNumAvailable(String telNum) is Tel Num Available boolean result = false; if (!isNullOrEmpty(telNum) && telNum.matches("^1[3458]{1}[0-9]{9}$")) { result = true; return result; |
boolean | isMobile(String mobiles) is Mobile Pattern p = Pattern .compile("^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$"); Matcher m = p.matcher(mobiles); return m.matches(); |
boolean | isMobileNO(String phoneNum) is Mobile NO final String regx = "^((13[0-9])|(15[^4,\\D])|(18[0-9]))\\d{8}$"; Pattern p = Pattern.compile(regx); Matcher m = p.matcher(phoneNum); return m.matches(); |
boolean | isLegalPhoneNumber(String phoneNumber) is Legal Phone Number String strPattern = "^((13[0-9])|(14[5,7])|(15[0-9])|(18[0-9]))[0-9]{8}$"; Pattern p = Pattern.compile(strPattern); Matcher m = p.matcher(phoneNumber); return m.matches(); |
boolean | checkPhone(String phone) check Phone Pattern pattern = Pattern.compile("^13/d{9}||15[8,9]/d{8}$"); Pattern p = Pattern .compile("^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$"); Matcher matcher = p.matcher(phone); if (matcher.matches()) { return true; return false; ... |
boolean | isPhoneNumber(String phoneNum) is Phone Number String expression = "^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$"; CharSequence inputStr = phoneNum; Pattern pattern = Pattern.compile(expression); Matcher matcher = pattern.matcher(inputStr); if (matcher.matches()) { return true; return false; ... |