3 ms·
Wow! That's a nifty little library. Just looking at the amount of options going into the main parser routine is mind blowing [1]. And the figuring out of encod
by valera_rozuvan 6y ago
Wow! That's a nifty little library. Just looking at the amount of options going into the main parser routine is mind blowing [1].
And the figuring out of encoding is also complex [2].
Once again, this is just to demonstrate that writing your own CSV parser from scratch is a total waste of time. Just use tools provided by your language. Many languages provide native support for CSV parsing. For example see docs for Microsoft C# [3].
----------
[1] https://github.com/pandas-dev/pandas/blob/v1.0.3/pandas/io/parsers.py#L530-L587 https://github.com/pandas-dev/pandas/blob/v1.0.3/pandas/io/p...
[2] https://github.com/pandas-dev/pandas/blob/v1.0.3/pandas/io/parsers.py#L954-L991 https://github.com/pandas-dev/pandas/blob/v1.0.3/pandas/io/p...
[3] https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/linq/how-to-generate-xml-from-csv-files https://docs.microsoft.com/en-us/dotnet/csharp/programming-g...
- tjalfi 6y agostring.Split is far from native support. If you don’t want to use third-party libraries then TextFieldParser[0] is part of the .NET framework. I use CsvHelper[1] in my projects. It can do pretty much anything although the newer versions have some dependencies. [0] https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualbasic.fileio.textfieldparser?view=netcore-3.1 https://docs.microsoft.com/en-us/dotnet/api/microsoft.visual... [1] https://joshclose.github.io/CsvHelper/ https://joshclose.github.io/CsvHelper/