unit Main;
interface
uses
Winapi.Windows,
Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
Vcl.StdCtrls,
System.Generics.Collections;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
type
test = record
feld1: Shortstring;
feld2: Shortstring;
feld3: Shortstring;
end;
ListeRecords = TList<test>;
implementation
{$R *.dfm}
function Stripped_Liste(Liste: ListeRecords; Stadt: string): ListeRecords;
var
i: integer;
test_rec: test;
begin
result.Clear;
for i := 0 to Liste.count - 1 do
begin
test_rec := Liste.Items[i];
if test_rec.feld3 = Stadt then
result.Add(test_rec);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
i: integer;
testrec: test;
RecordListe: ListeRecords;
LocalListe: ListeRecords;
begin
RecordListe.Create;
RecordListe.Clear;
testrec.feld1 := 'Walter';
testrec.feld2 := 'Müller';
testrec.feld3 := 'Berlin';
RecordListe.Add(testrec);
testrec.feld1 := 'Manfred';
testrec.feld2 := 'Bauer';
testrec.feld3 := 'Weimar';
RecordListe.Add(testrec);
LocalListe.Create;
LocalListe := Stripped_Liste(RecordListe, 'Berlin');
end;