[Lazarus] CSV parser class

Hans-Peter Diettrich DrDiettrich1 at aol.com
Sun Jan 24 15:23:07 CET 2010

Vladimir Zhirov schrieb:
>> Have you seen the built-in CSV support in TStrings?
> Yes, if I understand the documentation right, it can be used for basic
> per-line csv parsing only (using DelimitedText). It also requires to
> quote all characters below some code point, including spaces, that
> makes it impossible to read csv files saved from OO Calc or MSO Excel.
> If I'm wrong I would appreciate if someone point out my mistake.

I've added kind of an How To topic to TStrings, and also filed an bug 
report about StrictDelimiters. Currently StrictDelimiters is False when 
using CommaText. When True, DelimitedText will be read ignoring any but 
the defined Delimiter (hopefully unquoting if required), and will be 
written without any quotes.

CSV files have to be processed in two steps, one for entire lines (e.g. 
ReadLn or LoadFromFile), and another one for splitting a line into the 
CSV fields (using CommaText or DelimitedText).

BTW, we'll have to replace at least parts of the RTL/FCL (FPC) help, 
which is not very precise or informative right now.


More information about the Lazarus mailing list