Splitting string on commas when data can contain commas

前端 未结 3 856
小蘑菇
小蘑菇 2021-01-13 04:51

I have a CSV file (which I didn\'t design and I can\'t change now nor will I ever be able to change it) that contains lines like the following:

\"Surname, Firs

3条回答
  •  春和景丽
    2021-01-13 05:45

    I would suggest using a CSV parser library - there are other cases that you wouldn't have thought of (new line as part of a quoted field).

    The VisualBasic namespace has a nice library that can help - the TextFieldParser.

提交回复
热议问题