CSVReader
class in package klyn.io.csv

    public class CSVReader extends Object implements IList<ArrayList<String>>:

Object
└ CSVReader
All Implemented Interfaces: IList

RFC-4180 style CSV reader inspired by Python's `csv.reader`.

`CSVReader` materializes rows as an ordered read-only list and is directly iterable with `for row in reader`. Quoted fields may contain delimiters, CR/LF newlines and escaped quotes.

Example

    import klyn.io.csv

    reader = CSVReader(StringReader("name,city\n\"Ada, A.\",London"))
    for row as ArrayList<String> in reader:
    print(row.join(" | "))

Properties

Modifier and Type | Member | Description
--- | --- | ---
public override readonly property | size `size as ULong:` | Number of parsed rows.

Inherited Properties
property Inherited Properties from Object: type
property Inherited Properties from IList: size
Constructors

Modifier and Type | Member | Description
--- | --- | ---
public | CSVReader `CSVReader( filename as String, delimiter as Char = ',', quoteChar as Char = '"', escapeChar as Char = Char(0), doubleQuote as Boolean = true, skipInitialSpace as Boolean = false, strict as Boolean = true ):` | Reads and parses a CSV file.
public | CSVReader `CSVReader( path as Path, delimiter as Char = ',', quoteChar as Char = '"', escapeChar as Char = Char(0), doubleQuote as Boolean = true, skipInitialSpace as Boolean = false, strict as Boolean = true ):` | Reads and parses a CSV file.
public | CSVReader `CSVReader( reader as TextReader, delimiter as Char = ',', quoteChar as Char = '"', escapeChar as Char = Char(0), doubleQuote as Boolean = true, skipInitialSpace as Boolean = false, strict as Boolean = true ):` | Reads and parses all remaining text from a `TextReader`.

Methods

Modifier and Type | Member | Description
--- | --- | ---
public override | count `count(item as ArrayList<String>) as ULong:` | Counts rows equal to `item`.
public override | indexOf `indexOf(item as ArrayList<String>, start as Int = 0) as Int:` | Returns the first index of a parsed row.
public override | join `join(separator as String) as String:` | Joins row textual representations with a separator.
public override | lastIndexOf `lastIndexOf(item as ArrayList<String>, start as Int = -1) as Int:` | Returns the last index of a parsed row.
public | readRow `readRow(index as Int) as ArrayList<String>:` | Returns one parsed row.
public | readRows `readRows() as ArrayList<ArrayList<String>>:` | Returns the parsed rows.
public | rows `rows() as ArrayList<ArrayList<String>>:` | Alias for `readRows()`, useful when mirroring Python examples.
public | skip `skip(count as Int) as Void:` | Skips the next parsed rows.

Inherited Methods
method Inherited Methods from Object: deepCopy, fromJson, toDict, toJson, toString, toXml
method Inherited Methods from IList: count, indexOf, join, lastIndexOf
Operators

Modifier and Type | Member | Description
--- | --- | ---
public override | operator in(item as ArrayList<String>) as Boolean: | Returns true when `item` is one of the parsed rows.
public | operator[](index as Int) as ArrayList<String>: | Returns one parsed row.

Inherited Operators
operator Inherited Operators from IList: operator in(item as T) as Boolean, operator[](index as Int) as T