[Overview][Types][Procedures and functions][Index] Reference for unit 'LCSVUtils' (#lazutils)

LoadFromCSVFile

Loads and processes comma-separated values from the specified file.

Declaration

Source position: lcsvutils.pas line 25

procedure LoadFromCSVFile(

  aFilename: string;

  AProc: TCSVRecordProc;

  ADelimiter: Char = ',';

  CSVEncoding: TCSVEncoding = ceAuto

);

Arguments

aFilename

  

File name which contains the CSV data.

AProc

  

Routine used to load and process lines in the CSV data.

ADelimiter

  

Delimiter used to separate fields in the CSV data.

CSVEncoding

  

Character encoding used for the CSV data.

Description

LoadFromCSVFile is a procedure used to read and process delimited values from the file specified in the AFilename argument.

The procedure name is actually a misnomer; the routine uses the value in ADelimiter as the delimiter between field values. It does not have to be a Comma (,) character. Comma is, however, the default value for the ADelimiter argument.

LoadFromCSVFile reads lines of data from the file, and converts the encoded byte values to fields which are processed and applied using the procedure in AProc. Internally, it creates a temporary TFileStream instance for the specified file name. The LoadFromCSVStream routine is called to read and apply the content using the arguments in AProc, ADelimiter, and CSVEncoding.

See LoadFromCSVStream for more information about the arguments passed to the routine, and how the procedure is implemented.

See also

LoadFromCSVStream

  

Loads and processes comma-separated values from the specified stream.

TCSVEncoding

  

Represents character encodings used for values in CSV data.

TCSVRecordProc

  

Defines a procedure used to process field values.


Version 4.0 Generated 2025-05-03 Home