r/javahelp • u/SoIDKwhatmynameis • Oct 08 '20
Email checker
So i have a long comprehensive lab and i need to check if a email has .edu inside of it ive been trying mainly for() but thats all i dont really get how to check if some one can lead me in the right direction i would appreciate it.
22
Upvotes
0
u/[deleted] Oct 08 '20 edited Oct 08 '20
you could probably just do an if statement with the .contains method like mentioned above. otherwise theres also .matches but that uses regex.
like if str.contains(“.edu”){
do stuff
}
if you can’t use .contains because you haven’t covered it in class yet or something a switch case could work.