473,465 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Parsing text in .NET

2 New Member
I have a simple VB application that I'm trying to build. The user selects a text file from a dialog box and then I need to parse the data in the file.

The layout of the file looks like this:

C:\ xxxxxx ; yyyyyy ; zzzz C:\ xxxxxx ; yyyyyy ; zzzz C:\ xxxxxx ; yyyyyy ; zzzz C:\ xxxxxx ;
yyyyyy ; zzzz C:\ xxxxxx ; yyyyyy ; zzzz C:\ xxxxxx ; yyyyyy ; zzzz C:\ xxxxxx ; yyyyyy ; zzzz

I need to generate a output so it looks like this:

C:\ xxxxxx ; yyyyyy ; zzzz
C:\ xxxxxx ; yyyyyy ; zzzz
C:\ xxxxxx ; yyyyyy ; zzzz
C:\ xxxxxx ; yyyyyy ; zzzz
C:\ xxxxxx ; yyyyyy ; zzzz

What would do the trick for this task? I've got a StreamReader object using:
Dim oFile As StreamReader = New StreamReader(OpenFileDialog.FileName.ToString)

Now I just need to parse through the text, find out where the "C:\" are write a line to a new text file until I hit another C:\ in the file.

I'm verrrrry new to VB .NET, last version of VB I used was VB5; yikes!

Thanks in advance
Nov 8 '06 #1
1 1440
MDWeezer
2 New Member
Here is where I'm at so far. I can open the file, read it and re-write it with no problem to the output file. I need to figure out how to split up the string every time it encounters a "C:\".

Expand|Select|Wrap|Line Numbers
  1. Dim oFile As StreamReader = New StreamReade (OpenFileDialog.FileName.ToString)
  2.         Dim output As StreamWriter = New StreamWriter("Output.txt")
  3.         parseProgressBar.Visible = True
  4.         Dim line As String
  5.         line = oFile.ReadToEnd()
  6.         line.Split("C:\")  // This is what I need to get working.
  7.         output.WriteLine(line.ToString)
  8.         oFile.Close()
  9.         output.Close()
  10.  
Nov 8 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: Terry | last post by:
Hi, This is a newbie's question. I want to preload 4 images and only when all 4 images has been loaded into browser's cache, I want to start a slideshow() function. If images are not completed...
4
by: ralphNOSPAM | last post by:
Is there a function or otherwise some way to pull out the target text within an XML tag? For example, in the XML tag below, I want to pull out 'CALIFORNIA'. ...
3
by: Pir8 | last post by:
I have a complex xml file, which contains stories within a magazine. The structure of the xml file is as follows: <?xml version="1.0" encoding="ISO-8859-1" ?> <magazine> <story>...
7
by: Lucas Tam | last post by:
Hi all, Does anyone know of a GOOD example on parsing text with text qualifiers? I am hoping to parse text with variable length delimiters/qualifiers. Also, qualified text could run onto...
4
by: Earl | last post by:
I'm curious if there are others who have a better method of accepting/parsing phone numbers. I've used a couple of different techniques that are functional but I can't really say that I'm totally...
2
by: JaythePCguy | last post by:
Hi, I am trying to write a text parser to group all nonprintable and control characters, spaces and space delimited words in different groups using Regex class. Using a parsing of...
9
by: ankitdesai | last post by:
I would like to parse a couple of tables within an individual player's SHTML page. For example, I would like to get the "Actual Pitching Statistics" and the "Translated Pitching Statistics"...
3
by: toton | last post by:
Hi, I have some ascii files, which are having some formatted text. I want to read some section only from the total file. For that what I am doing is indexing the sections (denoted by .START in...
13
by: Chris Carlen | last post by:
Hi: Having completed enough serial driver code for a TMS320F2812 microcontroller to talk to a terminal, I am now trying different approaches to command interpretation. I have a very simple...
1
by: martinsson | last post by:
Hi all! I'm pretty mad about this... dont know what is going on. Im parsing XML file that looks like this: <something> __<item att="something">text<item> __<item...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
1
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...
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
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...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.