@Test public void testIsPhoneNumber() { assertTrue(ValidatorUtil.isPhoneNumber("123-456")); assertTrue(ValidatorUtil.isPhoneNumber("123 456 1111")); assertTrue(ValidatorUtil.isPhoneNumber("1234561111")); assertTrue(ValidatorUtil.isPhoneNumber("123-456 1111")); assertFalse(ValidatorUtil.isPhoneNumber("123+456+1111")); assertFalse(ValidatorUtil.isPhoneNumber("+456+1111")); assertFalse(ValidatorUtil.isPhoneNumber("AAA-456-1111")); }
public static boolean isPhoneNumber(String phoneNumber) { if (StringUtil.isEmpty(phoneNumber)) return false; String expression = "([\\d]*|[\\s]*|[-]*)*"; return isMatchRegex(phoneNumber, expression); }
ValidatorUtil { public static boolean isPhoneNumber(String phoneNumber) { if (StringUtil.isEmpty(phoneNumber)) return false; String expression = "([\\d]*|[\\s]*|[-]*)*"; return isMatchRegex(phoneNumber, expression); } }
ValidatorUtil { public static boolean isPhoneNumber(String phoneNumber) { if (StringUtil.isEmpty(phoneNumber)) return false; String expression = "([\\d]*|[\\s]*|[-]*)*"; return isMatchRegex(phoneNumber, expression); } private  ValidatorUtil(); }
ValidatorUtil { public static boolean isPhoneNumber(String phoneNumber) { if (StringUtil.isEmpty(phoneNumber)) return false; String expression = "([\\d]*|[\\s]*|[-]*)*"; return isMatchRegex(phoneNumber, expression); } private  ValidatorUtil(); static boolean isEmail(String email); static boolean isPhoneNumber(String phoneNumber); static boolean isMatchRegex(String input, String regex); static boolean isNumeric(String number); static boolean isValidDateRange(Date dateField1, Date dateField2, String dateFormat); }
ValidatorUtil { public static boolean isPhoneNumber(String phoneNumber) { if (StringUtil.isEmpty(phoneNumber)) return false; String expression = "([\\d]*|[\\s]*|[-]*)*"; return isMatchRegex(phoneNumber, expression); } private  ValidatorUtil(); static boolean isEmail(String email); static boolean isPhoneNumber(String phoneNumber); static boolean isMatchRegex(String input, String regex); static boolean isNumeric(String number); static boolean isValidDateRange(Date dateField1, Date dateField2, String dateFormat);  }