Search code examples
delphitinifile

Data that are not key-value pairs in TInifile


I use Delphi and want to use an Inifile containing following data:

[physicians]
Amy
Bart
Chloe
Dean
Evy
Frank
    

I thought TInifile's ReadSectionValues would handle this, but it appears all lines which are not key-value pairs are ignored. I would like to avoid adding dummy keys, like

[physicians]
dr_01 = Amy
dr_02 = Bart
dr_03 = Chloe
dr_04 = Dean
dr_05 = Evy
dr_06 = Frank
    

(Note that ReadSectionValues returns key-value pairs, not just the values, as the method's name suggests.)
Anyway, does TInifile have a method which can handle data without keys?


Solution

  • You can still have sections with no key-value pairs when working with TMemInifile. In that case these items are stored as keys. To retrieve the items of such a section use ReadSection.