How can I search faster for name/value pairs in a Delphi TStringList?

前端 未结 5 1638

I implemented language translation in an application by putting all strings at runtime in a TStringList with:

procedure PopulateStringList;
begin  
  EnglishStri         


        
5条回答
  •  星月不相逢
    2021-02-04 18:46

    If THashedStringList works for you, that's great. Its biggest weakness is that every time you change the contents of the list, the Hash table is rebuilt. So it will work for you as long as your list remains small or doesn't change very often.

    For more info on this, see: THashedStringList weakness, which gives a few alternatives.

    If you have a big list that may be updated, you might want to try GpStringHash by gabr, that doesn't have to recompute the whole table at every change.

提交回复
热议问题