Ask a New Question

Question

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
12 years ago

Answers

Steve
if (s.matches("\\.(com|edu|org)$")) {...} else {...}
12 years ago

Related Questions

How many bit strings of length eight either start with a 0 bit or end with the two bits 00? How many bit strings of length n are palindromes? Hint: Consider two cases n is even and n is odd. N... Two strings, each 19.5 m long, are stretched side by side. One string has a mass of 78.0 g and a ten... when all four strings are parallel the the pole, how can you be sure the pole is vertical . two strings are connecred to a 10 Kg mass with T2 making an angle 30 degree with the horizontal find... One of the 79.0 -long strings of an ordinary guitar is tuned to produce the note (frequency 245 ) w... The two strings have the same tension and mass per unit length, but they differ in length by 0.54 cm... How many different strings can be made from the letters in STATISTICS, using all the letters i am given strings at different angle connected to a sign that is at equilibrium. i am given the mas... The low strings in “In the Hall of the Mountain King” are accompanied by the sounds of bassoons. Whi...
Ask a New Question
Archives Contact Us Privacy Policy Terms of Use