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

Opens a CSV file without parsing its records. The file is owned by this generator and closed on exhaustion, failure or explicit close().

Parameters
ParameterDescription
filenameCSV file path.
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.
encodingCharset name; auto selects the Unicode BOM or UTF-8.
Throws
  • CSVException for an invalid filename or dialect.
  • IOException if opening the file or selecting its encoding fails.
Example

try reader = CSVReader("contacts.csv", delimiter=';'): print(reader.next())