delimiters using VB.net
-
I have a file which is seperated into fields by a comma for each field. I am trying to read the file into some type of structure but am unable to get past the point of reading upto the comma and then storing that away and then going back and reading the next field. Any help would be appreciated.
-
I have a file which is seperated into fields by a comma for each field. I am trying to read the file into some type of structure but am unable to get past the point of reading upto the comma and then storing that away and then going back and reading the next field. Any help would be appreciated.
For each line that you read in use split(',') on the string. The returned value will be an array of strings, each representing one field. --Colin Mackay--
"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)
-
I have a file which is seperated into fields by a comma for each field. I am trying to read the file into some type of structure but am unable to get past the point of reading upto the comma and then storing that away and then going back and reading the next field. Any help would be appreciated.
I assume you have some sort of CSV (Comma Separated Values) file, with a record on each line. Look into: * FileStream and StreamReader classes * StreamReader.ReadLine() Function * Split() Function on MSDN. -- Ian Darling "The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
-
I assume you have some sort of CSV (Comma Separated Values) file, with a record on each line. Look into: * FileStream and StreamReader classes * StreamReader.ReadLine() Function * Split() Function on MSDN. -- Ian Darling "The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
-
I have broken appart the file by using the split function but now have an issue with the carriage returns. The values from the last field of the line is put with the first field of the next line?
ccandler wrote: I have broken appart the file by using the split function but now have an issue with the carriage returns. The values from the last field of the line is put with the first field of the next line? :confused: Now I'm confused. You mean that each line of the file doesn't represent a full record, and that a record can overlap lines of the file? Maybe you could provide some sample data and information about the file format? A straight CSV would be readable the way suggested. -- Ian Darling "The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky