469,366 Members | 2,236 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,366 developers. It's quick & easy.

Split on tab character

I need to split on the tab character found in a string. What is used for the
character?
Nov 21 '05 #1
4 54165
Imports System.IO

Module Module1
Sub Main()
Dim reader As New StreamReader("c:\filename.txt")

Dim oneLine As String = reader.ReadLine()
While Not oneLine Is Nothing
Dim vals() As String = oneLine.Split(vbTab)

'Do something interesting with the array of strings
Dim s As String
For Each s In vals
Console.WriteLine(s)
Next

oneLine = reader.ReadLine()
End While
End Sub
End Module

"Robert Strickland" <bs*********@comporium.net> wrote in message
news:uy**************@TK2MSFTNGP12.phx.gbl:
I need to split on the tab character found in a string. What is used for
the
character?


Nov 21 '05 #2
Dim str As String = "This contains a" & vbTab & "Tab"

MessageBox.Show(str.Split(ControlChars.Tab)(0))
MessageBox.Show(str.Split(ControlChars.Tab)(1))

hope that helps..
Imran.

"Robert Strickland" <bs*********@comporium.net> wrote in message
news:uy**************@TK2MSFTNGP12.phx.gbl...
I need to split on the tab character found in a string. What is used for the character?

Nov 21 '05 #3
That worked nicely.

Thanks

"scorpion53061" <ad***@nospamherekjmsolutions.com> wrote in message
news:#F**************@TK2MSFTNGP09.phx.gbl...
Imports System.IO

Module Module1
Sub Main()
Dim reader As New StreamReader("c:\filename.txt")

Dim oneLine As String = reader.ReadLine()
While Not oneLine Is Nothing
Dim vals() As String = oneLine.Split(vbTab)

'Do something interesting with the array of strings
Dim s As String
For Each s In vals
Console.WriteLine(s)
Next

oneLine = reader.ReadLine()
End While
End Sub
End Module

"Robert Strickland" <bs*********@comporium.net> wrote in message
news:uy**************@TK2MSFTNGP12.phx.gbl:
I need to split on the tab character found in a string. What is used for
the
character?

Nov 21 '05 #4
"Robert Strickland" <bs*********@comporium.net> schrieb:
I need to split on the tab character found in a string.
What is used for the character?


'ControlChars.Tab' or 'vbTab'.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Stu Cazzo | last post: by
2 posts views Thread by dont bother | last post: by
4 posts views Thread by qwweeeit | last post: by
3 posts views Thread by John Salerno | last post: by
5 posts views Thread by kurt sune | last post: by
10 posts views Thread by vunet.us | last post: by
7 posts views Thread by Johny | last post: by
7 posts views Thread by Tom de Neef | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.