tbboyett
asked on
java string and wildcards
How can I check that a string is a valid email address? Would I use some kind of wildcard to check?
for example lets say we have an email address: someone@yahoo.com
and i want to make sure the string has some text, then an @ symbol, then some text, then a period, then some text.
The idea of wild card that I was thinking would be something like this:
String email = "someone@yahoo.com";
if(email.compareToIgnoreCa se("'%@%.% '") == 0) {
System.out.println("Email is valid");
}
I haven't tested this just because I don't know if java supports wildcards.
Any suggestions would be greatly appreciated
for example lets say we have an email address: someone@yahoo.com
and i want to make sure the string has some text, then an @ symbol, then some text, then a period, then some text.
The idea of wild card that I was thinking would be something like this:
String email = "someone@yahoo.com";
if(email.compareToIgnoreCa
System.out.println("Email is valid");
}
I haven't tested this just because I don't know if java supports wildcards.
Any suggestions would be greatly appreciated
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.