I have it coded to where a small list can have dupes removed rather efficiently. But, the larger the list gets, the longer it takes to the point that it is better to not even try. A list of 15,000 lines would takes hours and hours... probably longer to remove a lot of duplicates.
Here is what I have done:
procedure TMainForm.RemoveDuplicatesButtonClick(Sender: TObject);
var
i, j: integer;
label
Recheck;
begin
Recheck:
for i := 0 to ListView1.Items.Count - 1 do
for j := 0 to ListView1.Items.Count - 1 do
begin
if i = j then continue;
if ListView1.Items[i].Caption = ListView1.Items[j].Caption then
begin
ListView1.Items.Delete(j);
goto Recheck;
end;
ListView1.Columns[0].Caption := inttostr(ListView1.items.Count);
end;
CurrentStatusLabel.caption := 'Removed Duplicates';
end;
While this does work, like I said, it gets too slow for large lists. Is there a way to somehow load the list into memory to do this procedure? I know an array would be much faster, nut I'm not that far yet. This is in Tlistview of course Duoas as you well know by now.
Also, When I try to give a correct count of duplicates removed. It is not correct so I changed the label caption to just "Removed Duplicates".
Thanks as always for any help. :)