Ich finde deine Methode etwas sehr umständlich, probier mal das:
Delphi-Quellcode:
private
numbers: array of integer;
{ Private-Deklarationen }
...
procedure TForm1.Button1Click(Sender: TObject);
var i, j: integer;
function inarray(number: integer): boolean;
var i : integer;
begin
result := false;
for i := 0 to High(numbers) do begin
if numbers[i] = number then begin
result := true;
Break;
end;
end;
end;
begin
SetLength(numbers, 0);
for i := 0 to Memo1.Lines.Count - 1 do begin
if inarray(StrtoInt(Memo1.Lines.Strings[i])) = false then begin
j := High(numbers) + 1;
SetLength(numbers, j + 1);
numbers[j] := StrtoInt(Memo1.Lines.Strings[i]);
end;
end;
Memo1.Clear;
for i := 0 to High(numbers) do begin
Memo1.Lines.Add(InttoStr(numbers[i]));
end;
end;