Ezra,
In addition to using Split. I would consider using String.SubString along
with String.IndexOf or String.LastIndexOf, something like:
Dim MyString As String = "so*****@domain.com"
Dim MyChar As Char() = {"."c, "@"c}
Dim NewString As String
If MyString.IndexOfAny(MyChar) <> -1 Then
NewString = MyString.Substring(0,
MyString.LastIndexOfAny(MyChar))
End If
I would use IndexOfAny if I wanted to split at the first occurrence and
LastIndexOfAny if I wanted to split at the last occurrence.
FWIW: Consider what happens in the above with addresses such as
so******@domain.com, I know of a couple of Lotus Notes sites that use
fi****************@domain.com for their email addresses...
--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley -
http://www.tsbradley.net
<ez****@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
| I'm trying t use these lines below to get "new string = "someone", but
| it won't work. Instead it just keeps coming back as
| "so*****@domain.com". Is there something weird about there being an "@"
| character or a "." character?
|
| 'Dim MyString As String = "so*****@domain.com"
| 'Dim MyChar As Char() = {"."c, "@"c}
| 'Dim NewString As String = MyString.TrimEnd(MyChar)
| 'lblHolder.Text = NewString
|
| Thanks,
| Ezra
|