R Robert Strickland Oct 11, 2004 #1 I need to split on the tab character found in a string. What is used for the character?
S scorpion53061 Oct 11, 2004 #2 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
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
I Imran Koradia Oct 11, 2004 #3 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.
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.
R Robert Strickland Oct 11, 2004 #4 That worked nicely. Thanks scorpion53061 said: 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 Click to expand...
That worked nicely. Thanks scorpion53061 said: 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 Click to expand...
H Herfried K. Wagner [MVP] Oct 11, 2004 #5 Robert Strickland said: I need to split on the tab character found in a string. What is used for the character? Click to expand... 'ControlChars.Tab' or 'vbTab'.
Robert Strickland said: I need to split on the tab character found in a string. What is used for the character? Click to expand... 'ControlChars.Tab' or 'vbTab'.