klyn.io.csv.CSVReader.CSVReader
constructor
public CSVReader(
reader as TextReader,
delimiter as Char = ',',
quoteChar as Char = '"',
escapeChar as Char = '\u0000',
doubleQuote as Boolean = true,
skipInitialSpace as Boolean = false,
strict as Boolean = true
)
Description

Creates an unstarted CSV cursor over the remaining text of a reader. No input is read by this constructor. The provided reader is borrowed: it is never closed by CSVReader, even after an error or early loop exit. Buffering may read ahead of a record boundary; do not consume the borrowed reader separately while this cursor is active.

Parameters
ParameterDescription
readerNon-null input whose ownership remains with the caller.
delimiterField delimiter. Default is comma.
quoteCharQuote character; U+0000 disables quoting.
escapeCharEscape character; U+0000 disables escaping.
doubleQuoteDecode doubled quotes inside quoted fields.
skipInitialSpaceIgnore spaces before a field and after a closing quote.
strictReject malformed quoting when the affected record is read.
Throws
  • CSVException for a null reader or invalid dialect.
Example
try source = StringReader("name,city\n\"Ada, A.\",London"):
    for row in CSVReader(source):
        print(row.join(" | "))