If I had an email-
[email protected]
How would I split it so the end result would be
firstnam.lastname?
Thanks in advance everyone :D
Printable View
If I had an email-
[email protected]
How would I split it so the end result would be
firstnam.lastname?
Thanks in advance everyone :D
Code:Dim Email As String = "[email protected]"
Dim EmailStrSplit() As String = Email.Split(CChar("@"))
MessageBox.Show(EmailStrSplit(0))
There are lots of great examples around the internet, just google "Split string" in vb.net
Here is one great place to starthttp://www.homeandlearn.co.uk/net/nets7p7.html
Code:'the text string you want to split up
Dim LineOfText As String = TextBox1.Text
'creates and array to store the differrent string parts
Dim aryTextFile() As String
'Set the character to split the string on
aryTextFile = LineOfText.Split("@")
'returns the first part of array
MsgBox(aryTextFile(0))
I hope this helps get you going
Thanks everyone :) All of these are working. I did search on google, but it was a little confusing. These examples are much better : D