473,698 Members | 2,304 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 58873
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(v bTab)

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

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

"Robert Strickland" <bs*********@co mporium.net> wrote in message
news:uy******** ******@TK2MSFTN GP12.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(Cont rolChars.Tab)(0 ))
MessageBox.Show (str.Split(Cont rolChars.Tab)(1 ))

hope that helps..
Imran.

"Robert Strickland" <bs*********@co mporium.net> wrote in message
news:uy******** ******@TK2MSFTN GP12.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

"scorpion53 061" <ad***@nospamhe rekjmsolutions. com> wrote in message
news:#F******** ******@TK2MSFTN GP09.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(v bTab)

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

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

"Robert Strickland" <bs*********@co mporium.net> wrote in message
news:uy******** ******@TK2MSFTN GP12.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*********@co mporium.net> schrieb:
I need to split on the tab character found in a string.
What is used for the character?


'ControlChars.T ab' 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
31176
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 will split myString up using the delimiter of 1 space so that
2
21688
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 file is: Hello there I am doing fine How are you?
4
18294
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 succeeded in using re.split()...
3
2099
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; // Edward Two questions about this: 1. Why do you use single quotes with Split() instead of double? Is this
6
1752
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
5871
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() = Microsoft.VisualBasic.Strings.Split(aLine, vbNewLine, -1, CompareMethod.Binary)
10
5520
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 response.write (because it does not split) is: Microsoft VBScript runtime error '800a0009' Subscript out of range: '' /get_item.asp, line 55
7
3490
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 character. For example: if the main string S is S='abcde fghc ijkl mnop'
7
19336
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 = S.substr(0,P-2)+'x'+S.substr(P) Is there really no more trivial way? I'm looking for the write equivalent of S.charAt(P). TIA Tom
0
6257
!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 different in VB.NET. One of those I recently encountered is the String Class Split method. In VB6 Split is a function: Dim MySplittableString as String MySplittableString = "one,two,three,four,five" Dim MyArray() as String MyArray =...
0
8603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9157
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8895
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2329
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.