Field and record delimited text file

shootsnlad

Well-known member
Joined
Feb 14, 2002
Messages
46
I have a file that I need to split into fields within records. I was hoping to split it into an single array for each record with the fields being each part of the array. The fields are separated with the pipe "|" system. The records are seperated by the "~" system. The field delimits arent too bad, but Ive never worked with a record delimiter. Any ideas on this? Thanks!

shootsnlad
 
Read the file to a string

use the split function on "~" the get a RecordArray

loop through the RecordArray and split each element on the "|" symbol and get the FieldArray.
 
How would I go about reading the whole file into a string? I know how to read a single line of the file into a string, but not the whole file. Would I use a StreamReader? I have the filename in a string but when I try to do the following, it doesnt recognize "file":

Code:
dim sr as system.io.streamreader
Sr = File.OpenText(filename)

Thanks...
 
Now comes the tricky part. How do I split up an indivdual field based on a Carriage Return? What do I put inside of the quotes for the Split function?

shootsnlad
 
Back
Top