[Properties (by Name)] [Methods (by Name)] [Events (by Name)]
Class to parse a CSV file.
Source position: csvreadwrite.pp line 109
type TCSVParser = class(TCSVHandler) |
||
public |
||
constructor Create; override; |
|
Create a new instance of TCSVParser. |
destructor Destroy; override; |
|
Free the TCSVParser instance. |
procedure SetSource(); |
|
Set the CSV source data. |
procedure ResetParser; |
|
Reset the parser to its initial state. |
function ParseNextCell; |
|
Parse the next cell. |
property CurrentRow: Integer; [r] |
|
Row (zero based) of the current field. |
property CurrentCol: Integer; [r] |
|
Column (zero based) of the current field. |
property CurrentCellText: string; [r] |
|
Current field value. |
property MaxColCount: Integer; [r] |
|
Return the maximum column count encountered till now. |
property FreeStream: Boolean; [rw] |
|
Does the parser free the stream when done ? |
property BOM: TCSVByteOrderMark; [r] |
|
type of BOM marker found at the start of the data. |
property DetectBOM: Boolean; [rw] |
|
Must the parser attempt to read the BOM marker ? |
end; |
|
Class to parse a CSV file. |
|
| | ||
|
Base class for CSV reading and writing classes. |
|
| | ||
| | ||
TObject,IFPObserved |
TCSVParser can be used to read a CSV file. To use it, the stream or string containing the CSV data must be specified with SetSource, after which ParseNextCell can be called till it returns false. The current cell value after ParseNextCell returns True is available in CurrentCellText. By tracking CurrentRow, CurrentCol and MaxColCount, the structure of the CSV file can be determined.
|
Set the CSV source data. |
|
|
Parse the next cell. |
|
|
Current field value. |
|
|
Row (zero based) of the current field. |
|
|
Column (zero based) of the current field. |
|
|
Return the maximum column count encountered till now. |