I want to have a text file with a list of strings (say for example comma separated with key and values that I can use for auto replacement) and store each key-value pair in a TDictionary<string, string>
. How do I populate the dictionary?
If you only have one-to-one key-value relation (not like three key words "apple" and "apples" and "McIntoshes" would be turned into "McIntosh") - then probably the simpliest way would be to use TStringList, providing that
Key=Value
lines, not Key,Value
Then u use http://docwiki.embarcadero.com/Libraries/XE3/en/System.Classes.TStrings.Values
To speed things up a bit you can use THashedStringList of IniFiles unit. There also was somethign similar in JCL in JclXML unit.