473,503 Members | 1,629 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

new lines in text string

Hi,

I have this app that downloads a webpage via a WebClint object. It then
strips out all the unnecessary tags so that I have data that looks similiar
to

11/1/05,1,2,3,4,5,6\n11/2/05,2,3,4,5,6\n11/3/05,3,4,5,6,7\n

There are actual newline charactes in the data. When I write it to a file
the newlines are enabled so to speak and the data looks ok.

What I would like to do is load that long text stream into a
stringcollection container and have each real record a separate string in
the container.

Is there a way to do that automatically without having to parse thru
searching for every occurrance of '\n' or is that it?

I think its the latter but wanted to be surprised.

Thanks alot.
Mar 14 '06 #1
2 1398
ok I think I need to do something like this

Stream strm = m_WebClient.OpenRead(strURL);
StreamReader sr = new StreamReader(strm);
string line;
do
{
line = sr.ReadLine();
.....

Stupid me, should of looked harder before posting.


"Mike" <Mi**@mike.com> wrote in message
news:eK**************@TK2MSFTNGP11.phx.gbl...
Hi,

I have this app that downloads a webpage via a WebClint object. It then
strips out all the unnecessary tags so that I have data that looks
similiar to

11/1/05,1,2,3,4,5,6\n11/2/05,2,3,4,5,6\n11/3/05,3,4,5,6,7\n

There are actual newline charactes in the data. When I write it to a file
the newlines are enabled so to speak and the data looks ok.

What I would like to do is load that long text stream into a
stringcollection container and have each real record a separate string in
the container.

Is there a way to do that automatically without having to parse thru
searching for every occurrance of '\n' or is that it?

I think its the latter but wanted to be surprised.

Thanks alot.

Mar 14 '06 #2
True.

You could also do somthing like string.Split("\n");

"Mike" <Mi**@mike.com> wrote in message
news:e$**************@TK2MSFTNGP10.phx.gbl...
ok I think I need to do something like this

Stream strm = m_WebClient.OpenRead(strURL);
StreamReader sr = new StreamReader(strm);
string line;
do
{
line = sr.ReadLine();
....

Stupid me, should of looked harder before posting.


"Mike" <Mi**@mike.com> wrote in message
news:eK**************@TK2MSFTNGP11.phx.gbl...
Hi,

I have this app that downloads a webpage via a WebClint object. It then
strips out all the unnecessary tags so that I have data that looks
similiar to

11/1/05,1,2,3,4,5,6\n11/2/05,2,3,4,5,6\n11/3/05,3,4,5,6,7\n

There are actual newline charactes in the data. When I write it to a file
the newlines are enabled so to speak and the data looks ok.

What I would like to do is load that long text stream into a
stringcollection container and have each real record a separate string in
the container.

Is there a way to do that automatically without having to parse thru
searching for every occurrance of '\n' or is that it?

I think its the latter but wanted to be surprised.

Thanks alot.


Mar 20 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3528
by: BadOmen | last post by:
I have a text file that I want to save from my program. But I don't want to save the empty lines. I want to delete everything after the last character, Is that possible? Then when I read the...
22
61339
by: Ling Lee | last post by:
Hi all. I'm trying to write a program that: 1) Ask me what file I want to count number of lines in, and then counts the lines and writes the answear out. 2) I made the first part like this: ...
5
2718
by: Brian | last post by:
Hello all.. Am working on an Air Hockey game... have an table loaded into a picture box. The borders of the table are slightly slanted. Am using hit testing lines with GDI+ to manipulate the...
21
13024
by: JoKur | last post by:
Hello, First let me tell you that I'm very new to C# and learning as I go. I'm trying to write a client application to communicate with a server (that I didn't write). Each message from the...
23
2683
by: Paul Mars | last post by:
I need to limit multiline textbox to 3 lines of text and if there are less then 3 lines when leaving, add empty line holders. How can I do this?? Thanks, paul
2
9525
by: Becker | last post by:
This is probably a very dumb question, I am using VB.NET 2003 and I see where I can use a method to append text to a textbox, but how about remove? I have a textbox that I continually post log type...
3
5759
by: retsam | last post by:
All, I'm working on an ASP.NET 2.0 (C#) page and have a question on how to build a string that includes line feeds (new lines) that displays properly on an ASP.NET page. Here's what I got: ...
6
24132
by: ivan.perak | last post by:
Hello, im a beginner in VB.NET... The thing i would like to do is as it follows.... I have a text file (list of names, every name to the next line) which is about 350000 lines long. I would...
7
2087
by: peraklo | last post by:
Hello, there is another problem i am facing. i have a text file which is about 15000 lines big. i have to cut the last 27 lines from that file and create a new text file that contans those 27...
3
5555
by: Barkingmadscot | last post by:
I am stuck, i can workout how to remove lines from an array I have loading a text file (a Log), I know which lines a need, but the logs can be upto 30K sometimes bigger. I found trying to...
0
7072
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...
0
7271
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,...
1
6979
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
7449
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
5570
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,...
1
4998
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
3160
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...
0
1498
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 ...
1
730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.