Malformed

* Determines the behavior for when an error is detected. * * Disabling exception will follow these rules: *

    *
  • A quote can appear in a field if the field was not quoted.
  • *

  • If in a quoted field any quote by itself, not at the end of a * field, will end processing for that field.
  • *

  • The field is ended when there is no input, even if the quote was * not closed.
  • *

  • If the given header does not match the order in the input, the * content will return as it is found in the input.
  • *

  • If the given header contains columns not found in the input they * will be ignored.
  • *

Values

ValueMeaning
ignore

No exceptions are thrown due to incorrect CSV.

throwException

Use exceptions when input has incorrect CSV.

Examples

import std.algorithm.comparison : equal;
import std.algorithm.searching : count;
import std.exception : assertThrown;

string text = "a,b,c\nHello,65,\"2.5";
assertThrown!IncompleteCellException(text.csvReader.count);

// ignore the exceptions and try to handle invalid CSV
auto firstLine = text.csvReader!(string, Malformed.ignore)(null).front;
assert(firstLine.equal(["Hello", "65", "2.5"]));

Meta