Hey so I'm doing a project for school. We have to code a virtual atm machine. You would have to log in with your student mail.
My question is : How do I limit character length after a dot(.)?
public boolean validUsername(String username) {
Boolean oneAT = false;
for (int i=0; i < username.length(); i++) {
if (username.contains("@") && username.contains(".") &&{
oneAT = true;
}
}
return oneAT;
}
The function checks if the username typed, contains a @ and a .(dot). Is there a way to limit character length to three after the dot ? Otherwise the user can write johndoe@johndoemail.tugfksdoew