• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1214
  • Last Modified:

remove everything after @ in string

Hi,

I want to remove everything from an email string after @ symbol.
vb.net please.

Thanks
0
al4ddin
Asked:
al4ddin
1 Solution
 
Pratima PharandeCommented:
  Dim str As String
        str = "abc@mail.com"
        Dim newstr As String
        newstr = str.Substring(1, str.IndexOf("@")-1)

in newstr you will get result
0
 
nepaluzCommented:
Dim xStr as String = "myemail@domain.com"
Dim yStr As String = xStr.Split("@").First
0
 
Deepak LakkadCommented:
Hi

here is the modified code posted by Pratima_MCS

Dim str As String
        str = "abc@mail.com"
        Dim newstr As String
        newstr = str.Substring(0, str.IndexOf("@"))

Open in new window


- Deepak Lakkad
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now