DELPHI TSTRINGLIST ПОИСК
var
List: TStringList;
Index: Integer;
begin
List := TStringList.Create;
try
List.Add('Foo');
List.Add('Bar');
List.Add('Baz');
Index := List.IndexOf('Bar');
if Index >= 0 then
ShowMessage('Index of "Bar": ' + IntToStr(Index))
else
ShowMessage('"Bar" not found');
finally
List.Free;
end;
end;
var
List: TStringList;
Index: Integer;
begin
List := TStringList.Create;
try
List.Add('FooBar');
List.Add('BarBaz');
List.Add('BazFoo');
Index := List.Find('Bar', 0, False);
if Index >= 0 then
ShowMessage('Index of "Bar": ' + IntToStr(Index))
else
ShowMessage('"Bar" not found');
finally
List.Free;
end;
end;
var
List: TStringList;
Obj: TObject;
Index: Integer;
begin
List := TStringList.Create;
try
Obj := TObject.Create;
List.AddObject('Foo', Obj);
List.AddObject('Bar', nil);
List.AddObject('Baz', TObject.Create);
Index := List.IndexOfObject(Obj);
if Index >= 0 then
ShowMessage('Index of object: ' + IntToStr(Index))
else
ShowMessage('Object not found');
finally
List.Free;
end;
end;
var
List: TStringList;
function CompareStrings(List: TStringList; Index1, Index2: Integer): Integer;
begin
Result := -CompareText(List[Index1], List[Index2]);
end;
begin
List := TStringList.Create;
try
List.Add('ZZZ');
List.Add('BBB');
List.Add('AAA');
List.CustomSort(CompareStrings);
ShowMessage(List.Text);
finally
List.Free;
end;
end;
Searching an Array - Delphi Tutorial (Part 41)
Delphi #180 - TStringDynArray improved assignment capabilities
Listview - Delphi Tutorial
Delphi TreeView Programming Deleting Nodes
#0457 DELPHI pliki tekstowe - TStringList, TOpenDialog i TSaveDialog
Delphi Programming Tutorial #51 - TStringList and CSV Data
Delphi Programming Tutorial #12 - TListBox Part 1/2
String Handling in Delphi (part 5) Example of extracting strings
Delphi #164 - delphi-hlp.rualeFactor