hi, ich hoffe das hilft dir als Ansatzt
Delphi-Quellcode:
procedure DeleteDoubles(lv: TListView; SubItem: integer = -1);
var
li1 : TListItem;
li2 : TListItem;
x : integer;
y : integer;
begin
if lv.Items.Count < 1 then Exit;
lv.Items.BeginUpdate;
x := 0;
while x <= lv.Items.Count - 1 do
begin
li1 := lv.Items[x];
y := x + 1;
while y <= lv.Items.Count - 1 do
begin
li2 := lv.Items[y];
if SubItem > -1 then
begin
if AnsiSameText(li1.SubItems[SubItem], li2.SubItems[SubItem]) then
li2.Delete;
end
else
begin
if AnsiSameText(li1.Caption, li2.Caption) then
li2.Delete;
end;
inc(y);
end;
inc(x);
end;
lv.Items.EndUpdate;
end;