Link to home
Start Free TrialLog in
Avatar of al4ddin
al4ddin

asked on

remove everything after @ in string

Hi,

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

Thanks
Avatar of Pratima
Pratima
Flag of India image

  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
ASKER CERTIFIED SOLUTION
Avatar of nepaluz
nepaluz
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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