Split a string ignoring quoted sections

前端 未结 13 2356
别跟我提以往
别跟我提以往 2020-12-06 00:15

Given a string like this:

a,\"string, with\",various,\"values, and some\",quoted

What is a good algorithm to split this based on

13条回答
  •  北海茫月
    2020-12-06 00:37

    This is a standard CSV-style parse. A lot of people try to do this with regular expressions. You can get to about 90% with regexes, but you really need a real CSV parser to do it properly. I found a fast, excellent C# CSV parser on CodeProject a few months ago that I highly recommend!

提交回复
热议问题