What delimiter can be used for .csv that has "," in it's column

I want to read .csv file and write to other .csv file. I use streamwriter and use string.split with delimiter (',').

 using (StreamWriter file = new StreamWriter(destFile, true))             {                   string lines = System.IO.File.ReadAllLines(inputFile);                   foreach (string line in lines)                     {                         if (line != lines[0])                         {                               string[] values = line.Split(',');                             file.WriteLine("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}",                                     values[43], values[0], values[11], values[12], values[13], values[15], values[14], values[28], values[22], values[9]);  }}} 

But, there are few column that has , in it’s data such as shown below, thus producing incorrect output because the program has count it as the delimiter.

enter image description here

I have tried using tinyCSVParser library but it also using delimiter which will produce same result. When I change to CSVHelper library, it does not use delimiter but because the input file has column with name public double B/S, thus I stuck there because the properties cannot accept that name.

[Name("B/S")] private double p = 0; public double B/S {     get     {         return p;     }     set     {         double result;         result = double.Parse(Principal) * value / Day / 100;         p = Math.Abs(result);     } } 

What should I replace the delimiter with?

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.