Hi all,
I was able to parse and import .CSV file into database, but is having problem parsing .csv file that have comma contained within double quotes. For example,
"XX","XX XX","04011","XX XX XX","XX","XX,XX","XX","XX","XX","20141003 18:54","20141003 20:18","20141003 23:18"
When I parse the above line, "XX,XX" got insert to another column due to the comma in it.
What do I need to do to parse that as a single field for everything that contained within quotes? I'm working on a C# website by the way.
Thank you very much.


Jean-Claude Colette4 reputationPosted Oct 28, 2015, 2:17 AM EDT
Ekrem TapanRank #1,693 · 900 reputationPosted Oct 28, 2015, 7:55 AM EDT
Jean-Claude ColetteRank #2,678 · 520 reputationPosted Oct 28, 2015, 9:13 AM EDT
string output;
output = readline.Replace("\",\"", "\"~\"");
string[] cuted = output.Split('~');
output = "";
for (int i = 0; i < cuted.Length; i++) output += " #" + i + "=" + cuted[i];
Debug.WriteLine(output);
Jignesh TrivediRank #16 · 50.3K reputationPosted Oct 28, 2015, 8:31 PM EDT