How can I split an email address in C# using asp.net mvc? -
this question has answer here:
- c# splitting strings? 3 answers
i have example of email address "mynameismine@hotmail.com", want obtain or cut string value , obtain "mynameismine", dont want have "@hotmail.com".
if you're going manipulating email addresses you're best off using mailaddress class in system.net.mail namespace:
mailaddress addr = new mailaddress("mynameismine@hotmail.com"); string username = addr.user; string domain = addr.host; username part before '@' symbol , domain part after.
Comments
Post a Comment