Link to home
Start Free TrialLog in
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )Flag for United States of America

asked on

VB.NET - Process a block of text line-by-line

I have blocks of text that I need to process line-by-line. I'm accustomed to using the FileStream and ReadLine methods, but those work on files read from disc, it seems, and I can't translate that over to my need.

The textblocks look something like this, although they are much, much larger in the real world:
//STX12//830CATMF                                           SC
13MF CRTT Dir Global
14Z Z
15+00000000002C150306
15+00000000001D150317
15+00000000001D150416
//STX12//830MORTON      20150210064507 0411                            CAR
14Y Z
15+00000000028C150715
//STX12//830MORTON      20150210064506 0411                            CAR
01050411                          SH150401151202150209HESO51218
14Y Z
15+00000000040C150401
15+00000000040C150422
15+00000000040C150722

Open in new window

I'm breaking them on the lines beginning with "//STX12//", and I need to read each of those sub-blocks line-by-line. I see where .NET Framework 4.5 has the Text.ReadLines method, but I cannot require my client to upgrade to that framework.

What's the most efficient way to read a block of text line by line? Can I somehow "insert" that block of text into a FileStream object, and then use the methods there?
ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial