I'm writing Email Validator at the moment and I want to check if the string contains any SYMBOL(not digit or character) except '-','_','.', '@'. If it not contains,I have to raise the variable called "counter".
This is what I tried so far:
for (int i = 0; i < mail.length(); i++) {
if ((mail[i] >= 'A' && mail[i] <= 'Z') || (mail[i] >= 'a' && mail[i] <= 'z') || (mail[i] >= '0' && mail[i] <= '9') || (mail[i] == '.' || mail[i] == '-') || (mail[i] == '@' || mail[i] == '_')) {
if(i == mail.length()) {
counter+=1;
break;
}
}
}