unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
MyCountryDescriptions : TStringList;
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
MyCountryDescriptions : TStringList;
implementation
{$R *.dfm}
Procedure CopyCountryDescription(Const Country : String; Description : TStrings);
Var
i : Integer;
Begin
Description.Clear;
i:= MyCountryDescriptions.IndexOf('@@'+Country);
if i=-1 then exit; // Keine Beschreibung gefunden
inc(i);
Description.BeginUpdate;
Try
while (i<MyCountryDescriptions.Count) do
if Copy(MyCountryDescriptions[i],1,2) <> '@@' then
break
else begin
Description.Add(MyCountryDescriptions[i]);
inc(i);
end
finally
Description.EndUpdate;
end
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
MyCountryDescriptions := TStringList.Create;
MyCountryDescriptions.LoadFromFile('C:\MeinPfad\land.TXT');
CopyCountryDescription('Deutschland',Memo1.Lines);
FreeAndNil(MyCountryDescriptions);
end;
end.