csvparser

Naive csvparser. This code may work, or it may not. I just got bored by writing it repeatedly, so I thought I'd publish it.

Sample usage:

String test = '"Name";"Address";"Telephone"\n"Joe""Bloggs";"123 here street";"0123-123123"\nWithout quotes!;"𝄇";bc\n;42;\n';

void main() {
  CsvParser2 csvp = new CsvParser2(test, seperator:";", setHeaders:true);
  while(csvp.moveNext()) {
    print(csvp.getLineAsMap());
  }
}

results in:

{Name: Joe"Bloggs, Address: 123 here street, Telephone: 0123-123123}
{Name: Without quotes!, Address: 𝄇, Telephone: bc}
{Name: , Address: 42, Telephone: }

Changes:

  • now Unicode safe using the runes class!
  • removed CsvFieldType enum class

Libraries

csvparser
csvparser