Skip to content

TCSVHandler

Base class for CSV reading and writing classes.

Declaration

Source position: csvreadwrite.pp line 60

type

  TCSVHandler = class(TPersistent)
  public
    constructor Create;
    procedure Assign;
    procedure AssignCSVProperties;
    property Delimiter: TCSVChar; {rw}
    property QuoteChar: TCSVChar; {rw}
    property LineEnding: string; {rw}
    property IgnoreOuterWhitespace: Boolean; {rw}
    property QuoteOuterWhitespace: Boolean; {rw}
    property EqualColCountPerRow: Boolean; {rw}
  end;

Description

TCSVHandler is the base class for class TCSVParser which allows you to read a CSV file, and class TCSVBuilder which allows you to write a CSV file. It defines some common properties for these classes, mainly to describe the formatting of the CSV file, such as the Delimiter or QuoteChar and LineEnding properties.

Normally you will not create an instance of TCSVHandler, instead you will create a TCSVParser or TCSVBuilder instance.

Properties

Member Visibility Description
Delimiter public Field delimiter character.
EqualColCountPerRow public Ensure every row has an equal amount of columns.
IgnoreOuterWhitespace public Ignore whitespace between delimiters and field data.
LineEnding public Line ending character.
QuoteChar public Character to quote values.
QuoteOuterWhitespace public Write quotes when outer whitespace is found in a value.
See all Properties

Methods

Member Visibility Description
Assign public Assign properties from another TCSVHandler instance.
AssignCSVProperties public Assign properties from another TCSVHandler instance.
Create public Create an instance of TCSVHandler.
See all Methods

See also

Name Description
TCSVParser Class to parse a CSV file.
TCSVBuilder Class to write a CSV file.
Delimiter Field delimiter character.
QuoteChar Character to quote values.
LineEnding Line ending character.