[fpc-pascal] Container class for key-value pairs

Michael Van Canneyt michael at freepascal.org
Mon Sep 11 09:22:24 CEST 2017

On Mon, 11 Sep 2017, Marc Santhoff wrote:

> Hi,
> since I'm programming Pascal only on occasion I'd like to know:
> Which container class ist the easiest to use for key-value pairs?
> The goal is to store a configuration set from a hardware measuring
> device having 81 items. This item set is fixed, no change. The values
> are parsed from json data (text) and have to be stored in memory (for
> now).

You have several options. Plain TStringlist is easy to use:

Inifiles contains a tstrings descendent which is optimized for name/value pairs:

contnrs unit contains TFPStringHashTable:

TFPGMap from unit fgl can be used to create key/value map.

No doubt there are other options still.


More information about the fpc-pascal mailing list