Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dictionary (from Python) component for Delphi?

Is there similar component for Delphi like dictionary of Python?

I'm now using TStringList to map string/object pairs, but I'd like more general approach and maybe more powerful (TStringList has binary search when it is sorted).

Solutions for pre-D2009 are also welcome.

like image 774
Harriv Avatar asked Dec 01 '22 08:12

Harriv


2 Answers

There is in Delphi 2009. A whole new containers unit has been added, and a Dictionary class is one of the classes available.

Couple this with Generics, and you have a very powerful set of classes.

like image 198
Steve Avatar answered Dec 04 '22 08:12

Steve


There is a THashedStringList class (subclassed from TStringList) "hidden" in IniFiles.pas that can significantly speed up searching in a string list based dictionary.

like image 28
Gerry Coll Avatar answered Dec 04 '22 09:12

Gerry Coll