CSVReader.cs - MitchOSully/Visualising-the-DFN-Dataset GitHub Wiki

Summary

Has just one function that parses a CSV file.

The code used is from here, and was written by Teemu Ikonen.

List of Functions

Public Global Variables

List<Dictionary<string, object>> Read(string file)

Public Global Variables

string SPLIT_RE

Definition of the delimeters via regular expressions.

string LINE_SPLIT_RE

Definition of line delimiters via regular expressions.

char[] TRIM_CHARS

For trimming characters in every line.

List<Dictionary<string, object>> Read(string file)

Parses the CSV file into a List of Dictionarys of objects. Converts values into ints or floats where possible.

Params

Name Type Description
file string The name of the file to read. Does not include ".csv".

Returns

Name Type Description
list List<Dictionary<string, object>> The list containing parsed elements of the CSV file. Each list entry is a line in the file. Each dictionary entry is a element on the line. The keys for all the dictionaries are the first line of the file.

Calls

None

Called By