neo
neo

Reputation: 457

Reading csv file with fields in double quotes as structure

I want to read a CSV file using TextFieldParser with with the filed in double quotes and seperated with commas as the struture. How to get field values without double quotes after reading.

CSV struture is

"val1","val2","val3" "val4","val5","val6"

converted to val1,val2,val3 val4,val5,val6

Upvotes: 1

Views: 1011

Answers (1)

Ondrej Tokar
Ondrej Tokar

Reputation: 5070

Just replace all " with empty string.

 string yourCSVString; // "\"var1\",\"var2\",\"var3\"";
 string processedString;
 processedString=yourCSVString.Replace("\"","");
 Console.WriteLine(processedString);

Hope it helps.

Upvotes: 2

Related Questions