CSV

Structure for working with CSV-tables.

Constructors

this
this(string filepath)

The constructor takes a path to CSV-file.

this
this(string[][] table)

The constructor takes a two-dimensional array as the initiating table.

this
this(string filepath, string[][] table)

The constructor takes a path to future CSV-file and two-dimensional array as the initiating table.

this
this(string[] keys, string[][] table)

The constructor takes an array of table column names and a two-dimensional array as the initiating table.

Members

Aliases

deleteRowByField
alias deleteRowByField = deleteRowByKeyAndValue
Undocumented in source.

Functions

addRow
void addRow(string[] row)

The methods adds new table row.

addRow
void addRow(S args)
Undocumented in source. Be warned that the author may not have intended to support it.
createTable
void createTable(string[] keys, string[][] table)

The two-dimensional array will be used as the content of the CSV table.

createTable
void createTable(string[][] table)

The two-dimensional array will be used as the content of the CSV table.

deleteRowByKeyAndValue
void deleteRowByKeyAndValue(string key, string value)

The method deletes table row by field (by its key and value).

getArrayOfRowMaps
string[string][] getArrayOfRowMaps()

The method returns rows of the table as associative arrays, where keys are names of the columns and values are content of the fields.

getRowMapByField
string[string] getRowMapByField(string key, string value)

The method finds table row by field (by column name and value), returns associative array, where keys are names of columns and values are content of fields of this row.

getTable
string[][] getTable()

The method returns content of the table of the CSV-object as two-dimensional array.

getValueOfField
string getValueOfField(string key1, string value, string key2)

Finds the table field by another field in the same row (key1 and value) and column name (key2). Returns first match only.

rewrite
void rewrite()

The method writes table content to the initiating file.

setValueOfField
void setValueOfField(string key1, string value1, string key2, string value2)

The method sets new value (value2) by other field in the same row and column name.

writeTo
void writeTo(string filepath)

The method writes table content to the specified file.

Variables

headersOfColumns
string[] headersOfColumns;
Undocumented in source.

Meta