Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1
Use the "Contains" function to check for @ and .com strings. You can also use this function to verify there is no whitespace. var email = Console.ReadLine().Trim(); bool isValidEmail = false; if (email.Contains("@") && email.Contains(".com") && !email.Contains(" ")) { isValidEmail = true; }
15th Mar 2018, 11:18 PM
Akinni James
Akinni James - avatar