Unit EasyCSV
Uses
Functions and Procedures
Types
Variables
Description
Simple and fast reading and writing of CSV files.
This unit contains a simple API for reading and writing CSV files row by row.
Reading a CSV file is done with the class TCSVReader:
program ReadCSV; uses easycsv; var csv : TCSVReader; row : TCSVReader.TRow; i : Integer; begin csv := TCSVReader.Create('your-file.csv'); // Just show the csv file for row in csv do begin for i := 0 to row.Count - 1 do begin if i > 0 then write(' '); write(row[i]); end; writeln; end; csv.Free; end.
Writing a CSV file is done with the class TCSVWriter
:
program WriteCSV; uses easycsv; var csv : TCSVWriter; i : Integer; begin csv := TCSVWriter.Create('your-file.csv'); // Write a header line csv.AddRow(['Nr', 'Random number']); // Write some random lines for i := 1 to 10 do begin csv.AddRow([i, random(100)]); end; csv.Free; end.
Overview
Classes, Interfaces, Objects and Records
Name | Description |
---|---|
Class ECSVReadError |
Exception raised if some (format) error occurred when reading a CSV file. |
Class EBufferTooSmall |
This error is raised if the buffer is too small for the current row. |
Class TCSVReader |
Reader for CSV files. |
Class ECSVWriteError |
Exception raised if some error occurred during writing a CSV file. |
Class TCSVWriter |
A simple class to write CSV files row by row. |
Constants
MinBufSize = 4*1024; |
DefaultMaxBufSize = 64*1024; |
DefaultQuoteChar = '"'; |
DefaultDelimiter = ','; |
DefaultLineEnding = #10; |
DefaultIgnoreOuterWhitespace = true; |
Description
Constants
MinBufSize = 4*1024; |
Minimal buffer size of |
DefaultMaxBufSize = 64*1024; |
Maximal default buffer size of |
DefaultQuoteChar = '"'; |
DefaultDelimiter = ','; |
DefaultLineEnding = #10; |
DefaultIgnoreOuterWhitespace = true; |
Generated by PasDoc 0.15.0.