Reputation: 753
I use this code to remove duplicates:
procedure TForm1.RemoveDuplicates(StrList : TStringList);
var NoDuplicate: TStringList;
i: Integer;
begin
NoDuplicate := TStringList.Create;
try
NoDuplicate.Sorted := True;
NoDuplicate.Duplicates := dupIgnore;
///
for i := 0 to StrList.Count - 1 do
NoDuplicate.Add(StrList[i]) ;
///
NoDuplicate.Sorted:= False;
StrList.Assign(NoDuplicate) ;
finally
NoDuplicate.Free;
end;
end;
It works fine. But problem with "dupIgnore" is that it's not case-sensitive. For example, "rodeo" & "Rodeo" for "dupIgnore" are duplicates, although they are not. How to fix this?
Upvotes: 1
Views: 545