Solved

remove everything after @ in string

Posted on 2011-02-17
3
1,201 Views
Last Modified: 2012-06-27
Hi,

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

Thanks
0
Comment
Question by:al4ddin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 34914459
  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
 
LVL 17

Accepted Solution

by:
nepaluz earned 500 total points
ID: 34914529
Dim xStr as String = "myemail@domain.com"
Dim yStr As String = xStr.Split("@").First
0
 
LVL 11

Expert Comment

by:Deepak Lakkad
ID: 34914596
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

Featured Post

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question