Reading text file with variable field widths

C

Christie

I am using Visual Studio 2005 (VB.Net) to write my app. At some point
the app. need to read a text file with data in columner format. The
problem I have is that the columns are of variable width (not fixed).
Is there a way that I can use white space characters to distinguise
between different fields in a row?

The file is not comma or tab delimited, but it has spaces between
fields. Spaces are present only between individual fields, never in
the fields themselves.

Below is a couple of lines from the file.

1 PH5 902.0 MG 2 T1ORE 1 ORE1 2000 ALL
0.300

1 PH5 902.0 HB% 7 WS101 101 WST1 2000 ALL
0.600

1 PH9 1172.0 FD% 4 WS101 101 WST1 2000 ALL
0.500



Thanks
 
C

C-Services Holland b.v.

Christie said:
I am using Visual Studio 2005 (VB.Net) to write my app. At some point
the app. need to read a text file with data in columner format. The
problem I have is that the columns are of variable width (not fixed).
Is there a way that I can use white space characters to distinguise
between different fields in a row?

The file is not comma or tab delimited, but it has spaces between
fields. Spaces are present only between individual fields, never in
the fields themselves.

Below is a couple of lines from the file.

1 PH5 902.0 MG 2 T1ORE 1 ORE1 2000 ALL
0.300

1 PH5 902.0 HB% 7 WS101 101 WST1 2000 ALL
0.600

1 PH9 1172.0 FD% 4 WS101 101 WST1 2000 ALL
0.500



Thanks

They seem fixed width to me. You just have to decide where the borders
of the fields are.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top