473,396 Members | 1,853 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,396 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 58597
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...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.