Does any one know of a faster method to do String.Split()?

后端 未结 14 1202
傲寒
傲寒 2020-12-03 10:57

I am reading each line of a CSV file and need to get the individual values in each column. So right now I am just using:

values = line.Split(delimiter);
         


        
14条回答
  •  误落风尘
    2020-12-03 11:22

    CSV parsing is actually fiendishly complex to get right, I used classes based on wrapping the ODBC Text driver the one and only time I had to do this.

    The ODBC solution recommended above looks at first glance to be basically the same approach.

    I thoroughly recommend you do some research on CSV parsing before you get too far down a path that nearly-but-not-quite works (all too common). The Excel thing of only double-quoting strings that need it is one of the trickiest to deal with in my experience.

提交回复
热议问题