Parsing CSV File enclosed with quotes in C#

后端 未结 10 1976
一整个雨季
一整个雨季 2021-01-21 05:50

I\'ve seen lots of samples in parsing CSV File. but this one is kind of annoying file...

so how do you parse this kind of CSV

\"1\",1/2/2010,\"The sample (\"adas

10条回答
  •  猫巷女王i
    2021-01-21 06:15

    I very strongly recommend using TextFieldParser. Hand-coded parsers that use String.Split or regular expressions almost invariably mishandle things like quoted fields that have embedded quotes or embedded separators.

    I would be surprised, though, if it handled your particular example. As others have said, that line is, at best, ambiguous.

提交回复
热议问题