can anyone perform a code that when a user asked to put an email adress, the program prints output when find '@'( in c lang...) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

can anyone perform a code that when a user asked to put an email adress, the program prints output when find '@'( in c lang...)

23rd Jan 2019, 9:51 PM
Boniphace Mwampanda
Boniphace Mwampanda - avatar
3 Answers
+ 3
No idea what language you want, but just split the string by “@“ and take the first part. In JS: var str = “email@email.com” var email = str.split(“@“)[0]
23rd Jan 2019, 9:58 PM
Jax
Jax - avatar
+ 1
in java String email = "youremail@mail.com"; if(email.contains("@") && email.contains(".")) {System.out.println(email); } else System.out.println("Your email is invalid"); https://code.sololearn.com/cOcQ9Q72Mq8l/?ref=app
24th Jan 2019, 5:24 AM
HAS|B
HAS|B - avatar
0
In python : email = "x@email.com" if "@" in email: print("ok")
23rd Jan 2019, 10:03 PM
Théophile
Théophile - avatar