/**
* Verify that the mailbox input is legal
*
* @param stremail
* @return
*/
public static Boolean Isemail (String stremail) {
String Strpattern =
^ ([a-z0-9a-z]+[-|\\]?) +[a-z0-9a-z]@ ([a-z0-9a-z]+ (-[a-z0-9a-z]+) \ \.) +[a-za-z]{2,}$ ";
String Strpattern = "^\\s*\\w+ (?: \ \. {0,1} [\\w-]+) *@[a-za-z0-9]+ (?: [-.] [a-za-z0-9]+] *\\. [a-za-z]+\\s*$];
Pattern p = pattern.compile (Strpattern);
Matcher m = P.matcher (Stremail);
return m.matches ();
}
/**
* Verify if it is a mobile phone number
*
* @param str
* @return
*/
public static Boolean ismobile (String str) {
Pattern pattern = Pattern.compile ("1[0-9]{10}");
Matcher Matcher = Pattern.matcher (str);
if (Matcher.matches ()) {
return true;
} else {
return false;
}
}
This is the verification of the direct encapsulation, can be directly called in the future
Android to determine whether the login mailbox or phone number