By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,417 Members | 904 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,417 IT Pros & Developers. It's quick & easy.

Reading text file with variable field widths

P: n/a
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

Nov 8 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Christie wrote:
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.
--
Rinze van Huizen
C-Services Holland b.v
Nov 8 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.