473,385 Members | 1,342 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 58577
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Stu Cazzo | last post by:
I have the following: String myStringArray; String myString = "98 99 100"; I want to split up myString and put it into myStringArray. If I use this: myStringArray = myString.split(" "); it...
2
by: dont bother | last post by:
Hi Buddies, I am facing this problem and I dont know what to use as EOF in python: I want to read a file, and put all the individual words in a dictionary with their index: For example if the...
4
by: qwweeeit | last post by:
The standard split() can use only one delimiter. To split a text file into words you need multiple delimiters like blank, punctuation, math signs (+-*/), parenteses and so on. I didn't...
3
by: John Salerno | last post by:
This is an example in the book I'm reading: string fullName = " Edward C Koop "; fullName = fullName.Trim(); string names = fullName.Split(' '); string firstName = names; //...
6
by: | last post by:
How do I convert a single character, e.g. "a" into char for use in the 'split' command? p.s. I have option strict on Tia.
5
by: kurt sune | last post by:
The code: Dim aLine As String = "cat" & vbNewLine & "dog" & vbNewLine & "fox" & vbNewLine Dim csvColumns1 As String() = aLine.Split(vbNewLine, vbCr, vbLf) Dim csvColumns2 As String() =...
10
by: vunet.us | last post by:
Hello, I use XMLHTTP to get an HTML of another page. Then, I need to cut some middle part of that HTML string but I have problems doing it (see note in caps below). The error I have generated at...
7
by: Johny | last post by:
I have a string of a variable length and I need to split the string in strings of 6 characters . But if the 6th character is not space then I must split the string at possition before the 6th...
7
by: Tom de Neef | last post by:
I need to change one character at a known position in a string. In Pascal I would change the P's character of a string S into 'x' with S:='x'; In JavaScript I come no further than S =...
0
!NoItAll
by: !NoItAll | last post by:
For those of you who have graduated from VB6 to VB.NET; one of the things you have undoubtedly encountered is how functionality you expected to be the same, or similar to VB6 turned out completely...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.