TStringList

This is an old revision of TStringList, edited by Arent at . The current revision is 116186.

A TStringList is a datatype that can hold an arbitrary length list of strings. The strings in a TStringList are accessible as concatenated plain text or as a series of strings. Functionality is also provided for key-value pair access.

Inheritance

TStringList adds sorting functionality to TStrings by adding properties Sorted, Duplicates and CaseSensitive and methods like Find to facilitate speeded search within a list.

Example

  // get a value from file FILNAM filled with key=value pairs 
function GetValueFromFile( filnam: string, key: string ): string;
var
  lst: TStringList;
  v: String;
begin
  lst := TStringList.Create();
  lst.CaseSensitive := false;
  lst.Duplicates := false;
  lst.Sorted := true;
  lst.ReadFromFile( filnam );
  v := lst.Values[ key ];
  lst.Free();
  result := v;
end;

See also