procedure TForm1 Button2Click Sender TObject var deleted integer str s

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
procedure TForm1.Button2Click(Sender: TObject);
var
i, j, n, deleted: integer;
str: string;
number, f: bool;
toDelete: array [1..1000] of integer;
begin
n := 0;
for i := 0 to ListBox1.Items.Count - 1 do
begin
str := ListBox1.Items[i];
number := true;
for j := 1 to length(str) do
if not (str[j] in ['0'..'9']) then
number := false;
if number then
if (RadioGroup1.ItemIndex = 0) then
f := StrToInt(str) mod 2 = 0
else
f := StrToInt(str) mod 2 = 1
else f := false;
if number and f then
begin
toDelete[n] := i;
n := n + 1;
end;
end;
deleted := 0;
for i := 0 to n - 1 do
begin
ListBox1.Items.Delete(toDelete[i - deleted]);
deleted := deleted + 1;
end;
end;