I thought this will be trivial but I can\'t get this to work.
Assume a line in a CSV file:
\"Barack Obama\", 48, \"President\", \"1600 Penn Ave, Washington DC
You should be using Microsoft.VisualBasic.FileIO.TextFieldParser
for that. It will handle all the CSV stuff correctly for you, see: A similar question with example using the TextFieldParser
PS: Do not fear using the Microsoft.VisualBasic dll in a C# project, it's all .NET :-)
Can't you change how the CSV is generated? Using OpenOffice, you can set the char separator (use ;) and how the string is delimited (using " or ').
It would be like this: 'President';'1600 Penn Ave, Washington DC'
string temp = line.Replace( "\"", "" );
string[] tokens = temp.Split(',')