Home > Back-end >  consult
consult

Time:09-27

Judge enter Java file name is correct, whether mail format is correct, including: legal name should with the Java end; Contain at least the @, legitimate email name and ask the @ in the before,
If (fileName. Length () fileName. The substring (" Java ") {
System. The out. Println (" Java file name right ");
}
The else {
System. The out. Println (" Java file name is invalid ");
}

Int a=email. LastIndexOf (" @ ");
Int b=email. LastIndexOf (". ");
If (a!=1 & amp; & B!=1 & amp; & a{
System. The out. Println (" mailbox name right ");
}
The else {
System. The out. Println (" invalid email name ");
}

}


}

CodePudding user response:

Under the regular understanding match email
String reg="[a-z] + [A - z0 - _ - 9] * \ \ @ [A - z0-9] + \ \ [a-z] +";
System. The out. Println (" [email protected] ". Matches (reg));