Asked by Joel Borja

Alright I have these strings

String domain1 = ". com";
String domain2 = ". edu";
String domain3 = ". org";

I want to make sure that when the user puts in their username (their email) that the domain will be the last four characters. How do I get this to happen? Thank you

Answers

Answered by Steve
if (s.matches("\\.(com|edu|org)$")) {...} else {...}
There are no AI answers yet. The ability to request AI answers is coming soon!

Related Questions