#CSVParser.NET CSV parser library for .NET
CsvParser.Parser parser = new CsvParser.Parser();
List<List<string>> result = parser.Parse("a,b,c");
string v1 = result[0][0]; // "a"
- Parse CSV format string and return a 2 dimensional string List
List<List<string>>
. - Normalize CR(
\r
) and CRLF(\r\n
) into LF(\n
) before parsing. - Deal with double quotes columns.
- Deal with Excel CSV with double quotes and LF.
- Skip rows using
SkipKeyWords
.
hello world | 123 | 456 |
---|---|---|
abc,def |
CsvParser.Parser parser = new CsvParser.Parser();
List<List<string>> result = parser.Parse("\"hello world\",123,456\n" +
"\"abc,def\"");
int rowCount = result.Count; //-> 2
string v1 = result[0][0]; //-> "hello world"
string v2 = result[0][1]; //-> "123"
hello world |
12,3 | 456 |
---|---|---|
abc | def |
CsvParser.Parser parser = new CsvParser.Parser();
List<List<string>> result = parser.Parse("\"hello\n" +
"world\","12,3",456\n" +
"abc,def");
int rowCount = result.Count; //-> 2
string v1 = result[0][0]; //-> "hello\nworld"
string v2 = result[0][1]; //-> "12,3"
hello world | 123 | 456 |
---|---|---|
REM | def | ghi |
CsvParser.Parser parser = new CsvParser.Parser();
parser.SkipKeyWord.Add("REM");
List<List<string>> result = parser.Parse("\"hello world\","123",456\n" +
"REM,def,ghi");
int rowCount = result.Count; //-> 1
string v1 = result[0][0]; //-> "hello world"
http://www.nuget.org/packages/CsvParser.NET/
Copyright (c) 2014 kenyamat. Licensed under MIT.