struct CSV
Structure for working with CSV-tables.
this(string filepath, string[][] table)
The constructor takes a path to future CSV-file and two-dimensional array as the initiating table.
Parameters
| filepath | Path to file for saving CSV table. The existence of the file, as well as its contents, do not matter. |
| table | 2D array with content for the CSV file. |
string[string][] getArrayOfRowMaps() const
The method returns rows of the table as associative arrays, where keys are names of the columns and values are content of the fields.
string getValueOfField(string key1, string value, string key2) const
Finds the table field by another field in the same row (key1 and value) and column name (key2). Returns first match only.
string[string] getRowMapByField(string key, string value) const
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.
void deleteRowByKeyAndValue(string key, string value)
The method deletes table row by field (by its key and value).
void createTable(string[][] table)
The two-dimensional array will be used as the content of the CSV table.
void createTable(string[] keys, string[][] table)
The two-dimensional array will be used as the content of the CSV table.
Parameters
| keys | Titles for columns. |
| table | 2D array for CSV fields. |