![]() |
![]() ![]() ![]() |
acStringListContainer component.
|
property Names[Index: Integer]: String;
|
The Names is the run-time only property, which can be used to read or modify the first part of string, separated on 2 parts with some character of string specified in NVSeparator property. The Names property should be used only if each string of the list is organized in the manner of "name=value" and allows to retreive and modify the "names" (as well as Values property gives an access to "values").
|
|
With the Names you can access a first part of a specific string ("name" part, before separator), to read or modify the "name" at a particular position. Index gives the position of the string, where 0 is the position of the first string, 1 is the position of the second string, and so on ("Count - 1" is the position of last string in the list).
|
|
To locate a particular string in the list, call IndexOf method, or use IndexOfName and IndexOfValue methods if the string list is the list of "names=values" (where each string is some "name" and "value", separated with some character).
|
|
![]() |
procedure TForm1.Button1Click(Sender: TObject);
|
begin
|
// retreives the "name", by index entered in some Edit box, and displays it in some Label
|
Label1.Caption := acStringListContainer1.Names[StrToIntDef(Edit1.Text, 0)];
|
|
// modifies the "name" part of the first string
|
acStringListContainer1.Names[0] := 'Hello';
|
// modifies the "value" part of the first string
|
acStringListContainer1.Values[0] := 'World!';
|
|
// the example above is the same as example below, if NVSeparator property is '='
|
acStringListContainer1.Strings[0] := 'Hello=World!';
|
end;
|
Values, Strings and NVSeparator properties;
|
LoadFromRegistry and StoreToRegistry methods.
|