TStringList.Values
property Names[Name: String]: String Access mode: RW
Contents
Description
Values represents the value parts of the name-value pairs in the list.
Reading
When reading this property, if there is a name-value pair in the list of strings that has name part Name, then the corresponding value is returned. If there is no such pair, an empty string is returned.
Writing
When writing this value, first it is checked whether there exists a name-value pair in the list with name Name. If such a pair is found, it's value part is overwritten with the specified value. If no such pair is found, a new name-value pair is added with the specified Name and value.
Example
var
s: TStringList;
begin
s := File.CreateStringList();
s.Append('a=1');
s.Append('b=2');
s.Append('c=3');
s.Append('d=4');
s.Append('e=5');
WriteLn(s.Strings[2]); // c=3
WriteLn(s.Names[2]); // c
WriteLn(s.Values[s.Names[2]]); // 3
s.Values['e'] := '51';
WriteLn(s.Values['e']); // 51
s.Values['f'] := '6';
WriteLn(s.Values['f']); // 7
s.Free;
end.