Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parsing a .txt file in ASP

Status
Not open for further replies.

Jay2003

Programmer
Feb 26, 2003
147
0
0
GB
Hi,

I have a .txt file with the following line in it.

N 081 00 3150 A111006 03/17 09:44:59 00:00:36.0

What I am trying to do is load the file from ASP, Then seperate into a table with different fieldss.

Field1 = Chr1
Field2 = Chr 3 to 5
Field3 = Chr 7 to 8

I can read the file ok, I can even out the entire string but I cannot seperate the fields.

Amy suggestions would be appreciated.

Rgds

Jason

 
If the fields are a fixed number of characters you can use the Mid() function.

Mid(YourString, StartPos, # of chars)

Field1 = Mid(YourString, 1, 1)
Field2 = Mid(YourString, 3, 3)
Field3 = Mid(YourString, 7, 2)
 
... and if you need to go further, use the replace and split functions to parse into an array.


:) -Andrew

alien.gif

[TAG]
... If you find my posts helpful, rate me up! ...
anongod@hotmail.com
'Drawing on my fine command of language, I said nothing.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top