TCSVParser class
Class to parse a CSV file.
Declaration
TCSVParser = class(TCSVHandler)Inheritance
- TCSVParser
- TCSVHandler
- TPersistent
- TObject
Description
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.See also
Properties
CurrentRow | public | Row (zero based) of the current field. |
CurrentCol | public | Column (zero based) of the current field. |
CurrentCellText | public | Current field value. |
MaxColCount | public | Return the maximum column count encountered till now. |
FreeStream | public | Does the parser free the stream when done ? |
BOM | public | type of BOM marker found at the start of the data. |
DetectBOM | public | Must the parser attempt to read the BOM marker ? |
Methods
Create | public | Create a new instance of TCSVParser. |
Destroy | public | Free the TCSVParser instance. |
SetSource | public | Set the CSV source data. |
ResetParser | public | Reset the parser to its initial state. |
ParseNextCell | public | Parse the next cell. |
Inherited
From TCSVHandler (8)
Assign AssignCSVProperties Delimiter EqualColCountPerRow IgnoreOuterWhitespace LineEnding QuoteChar QuoteOuterWhitespace
From TPersistent (7)
AssignTo DefineProperties FPOAttachObserver FPODetachObserver FPONotifyObservers GetNamePath GetOwner
From TObject (40)
AfterConstruction BeforeDestruction CheckDisposed ClassInfo ClassName ClassNameIs ClassParent ClassType CleanupInstance DefaultHandler DefaultHandlerStr Dispatch DispatchStr Disposed DisposeOf Equals FieldAddress Free FreeInstance GetDisposed GetHashCode GetInterface GetInterfaceByStr GetInterfaceEntry GetInterfaceEntryByStr GetInterfaceTable GetInterfaceWeak GetLastCastErrorInfo InheritsFrom InitInstance InstanceSize MethodAddress MethodName newinstance QualifiedClassName SafeCallException StringMessageTable SystemHasExtendedRTTI ToString UnitName
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
