I am trying to check if a string is valid by checking if it contains special words that are set in an array
String email = "this@webmaster";
tv.setText(Boolean.toString(checkEmailValidity(email)));
}
public boolean checkEmailValidity(String email) {
String[] specialWords = {"webmaster", "government"};
if( email.contains(specialWords.toString())||email.contains(" ")){
return false;
}
return true;
}
The result is always true so the statement that checks the email with the specialWords is not good. What can I do?