I'm trying to read an csv file with the format: name, location Joseph, "street xpto, London"
When I read CSV, I split the file to ",", but when the line has "street xpto, London" (other commas) it doesn't work.
Is there some solution to that? I need to do split ignoring commas when find an " ".
var reader = new StreamReader(File.OpenRead(@"C:\example_File.csv"));
while (!reader.EndOfStream)
{
var line = reader.ReadLine();
String[] values = line.Split(',');
for (int i = 0; i < values.Length; i++)
{
}
}
TextFieldParserorFileHelpersare ways to go