Einzelnen Beitrag anzeigen

Klaus01

Registriert seit: 30. Nov 2005
Ort: München
5.755 Beiträge
 
Delphi 10.4 Sydney
 
#2

AW: Delete duplicates from list

  Alt 3. Jan 2012, 18:41
.. could it be that I has never value -1
because S is in the List and you will get for I the position in the List of S.

Delphi-Quellcode:
for S in List do
  begin
    I := List.IndexOf(S);
    while I = -1 do
    begin
      List.Delete(I);
      I := List.IndexOf(S);
    end;
  end;
edit:
If you want to use TStringList there is an property called duplicates
This can be set to avoid duplicate entries in the list.

Best regards
Klaus
Klaus

Geändert von Klaus01 ( 3. Jan 2012 um 18:58 Uhr)
  Mit Zitat antworten Zitat