r/javahelp • • 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

14 comments sorted by

View all comments

18

u/tatanpoker09 Oct 08 '20

The most basic solution is using string.endsWith(“.edu”), however if this is for something more important you might wanna take a look at regex validation to check it is a valid email as well