Splitting a CSV and excluding commas within elements

前端 未结 4 1846
夕颜
夕颜 2020-12-21 06:31

I\'ve got a CSV string an I want to separate it into an array. However the CSV is a mix of strings and numbers where the strings are enclosed in quotes and may contain comma

4条回答
  •  孤城傲影
    2020-12-21 07:04

    I would suggest using one of the following solutions, was just testing a few of them (hence the delay):-

    1. Regex matching commas not found within an enclosing double aprostophe
    2. A Fast CSV Reader - for read CSV only
    3. FileHelpers Library 2.0 - for read/write CSV

    Hope this helps.

提交回复
热议问题