C# Class Encog.Util.CSV.ReadCSV

Read and parse CSV format files.
Show file Open project: encog/encog-silverlight-core Class Usage Examples

Public Methods

Method Description
Close ( ) : void

Close the file.

Get ( String column ) : String

Get the column by its string name, as a string. This will only work if column headers were defined that have string names.

Get ( int i ) : String

Get the specified column as a string.

GetCount ( ) : int

Get the column count.

GetDate ( String column ) : System.DateTime

Read the specified column as a date.

GetDate ( int column ) : System.DateTime

Read the specified column as a date.

GetDouble ( String column ) : double

Get the specified column as a double.

GetDouble ( int column ) : double

Get the specified column as a double.

GetInt ( String col ) : int

Get an integer that has the specified name.

GetTime ( String column ) : System.DateTime

Read the specified column as a time.

GetTime ( int column ) : System.DateTime

Read the specified column as a time.

HasMissing ( ) : bool

Check to see if there are any missing values on the current row.

Next ( ) : bool

Read the next line.

ParseDate ( String when, String dateFormat ) : System.DateTime

Parse a date using the specified format.

ReadCSV ( Stream stream, bool headers, CSVFormat format ) : System

Construct a CSV reader from an input stream. The format parameter specifies the separator character to use, as well as the number format.

ReadCSV ( Stream istream, bool headers, char delim ) : System

Construct a CSV reader from an input stream.

ReadCSV ( String filename, bool headers, CSVFormat format ) : System

Construct a CSV reader from a filename. Allows a delimiter character to be specified. Numbers will be parsed using the current locale.

ReadCSV ( String filename, bool headers, char delim ) : System

Construct a CSV reader from a filename.

Private Methods

Method Description
Begin ( bool headers, CSVFormat format ) : void

Read the headers.

GetLong ( int col ) : long
InitData ( string line ) : void

Count the columns and create a an array to hold them.

Parse ( string line ) : IList
ParseCharSep ( string line ) : IList

Parse the line into a list of values.

ParseSpaceSep ( String line ) : List

Parse a line with space separators.

Method Details

Close() public method

Close the file.
public Close ( ) : void
return void

Get() public method

Get the column by its string name, as a string. This will only work if column headers were defined that have string names.
public Get ( String column ) : String
column String The column name.
return String

Get() public method

Get the specified column as a string.
public Get ( int i ) : String
i int The column index, starting at zero.
return String

GetCount() public method

Get the column count.
public GetCount ( ) : int
return int

GetDate() public method

Read the specified column as a date.
public GetDate ( String column ) : System.DateTime
column String The specified column.
return System.DateTime

GetDate() public method

Read the specified column as a date.
public GetDate ( int column ) : System.DateTime
column int The specified column.
return System.DateTime

GetDouble() public method

Get the specified column as a double.
public GetDouble ( String column ) : double
column String The column to read.
return double

GetDouble() public method

Get the specified column as a double.
public GetDouble ( int column ) : double
column int The column to read.
return double

GetInt() public method

Get an integer that has the specified name.
public GetInt ( String col ) : int
col String The column name to read.
return int

GetTime() public method

Read the specified column as a time.
public GetTime ( String column ) : System.DateTime
column String The specified column.
return System.DateTime

GetTime() public method

Read the specified column as a time.
public GetTime ( int column ) : System.DateTime
column int The specified column.
return System.DateTime

HasMissing() public method

Check to see if there are any missing values on the current row.
public HasMissing ( ) : bool
return bool

Next() public method

Read the next line.
public Next ( ) : bool
return bool

ParseDate() public static method

Parse a date using the specified format.
public static ParseDate ( String when, String dateFormat ) : System.DateTime
when String A string that contains a date in the specified format.
dateFormat String The date format.
return System.DateTime

ReadCSV() public method

Construct a CSV reader from an input stream. The format parameter specifies the separator character to use, as well as the number format.
public ReadCSV ( Stream stream, bool headers, CSVFormat format ) : System
stream Stream The Stream to read from.
headers bool Are headers present?
format CSVFormat What is the CSV format.
return System

ReadCSV() public method

Construct a CSV reader from an input stream.
public ReadCSV ( Stream istream, bool headers, char delim ) : System
istream Stream The InputStream to read from.
headers bool Are headers present?
delim char What is the delimiter.
return System

ReadCSV() public method

Construct a CSV reader from a filename. Allows a delimiter character to be specified. Numbers will be parsed using the current locale.
public ReadCSV ( String filename, bool headers, CSVFormat format ) : System
filename String The filename.
headers bool The headers.
format CSVFormat The delimiter.
return System

ReadCSV() public method

Construct a CSV reader from a filename.
public ReadCSV ( String filename, bool headers, char delim ) : System
filename String The filename.
headers bool The headers.
delim char The delimiter.
return System