shootsnlad Posted April 30, 2003 Posted April 30, 2003 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 aren't too bad, but I've never worked with a record delimiter. Any ideas on this? Thanks! shootsnlad Quote
TheExtreme Posted April 30, 2003 Posted April 30, 2003 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. Quote
shootsnlad Posted May 1, 2003 Author Posted May 1, 2003 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 doesn't recognize "file": dim sr as system.io.streamreader Sr = File.OpenText(filename) Thanks... Quote
shootsnlad Posted May 1, 2003 Author Posted May 1, 2003 Nevermind, I got it. It should be: Sr = system.io.File.OpenText(filename) Thanks! Quote
shootsnlad Posted May 2, 2003 Author Posted May 2, 2003 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 Quote
goddesso Posted February 22, 2004 Posted February 22, 2004 Put vbCrLf inside your quotes to initialize it as the delimiter. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.