![]() |
Re: Stringlist dupOnly
Zitat:
Danke für den Hinweis. Sodele, etwas pervers aber so geht es auch:
Delphi-Quellcode:
Grüße
procedure OnlyDupes(var slList: TStringList);
var sl1,sl2 : TStringList; i: Integer; begin sl1 := TStringList.create; sl1.sorted:=true; sl1.duplicates:=dupIgnore; sl2 := TstringList.create; sl2.sorted:=true; sl2.Duplicates:=dupError; for i:=0 to slList.count -1 do try sl2.add(slList[i]); except on E: Exception do begin sl1.add(slList[i]); end; end; slList.assign(sl1); sl1.free; sl2.free; end; Klaus |
Re: Stringlist dupOnly
Hallo Klaus,
ja, so funktioniert es - ich bin beeindruckt! Der temporäre Ressourcenverbrauch ist auch recht gering (heute aber meist ohnehin kein Thema mehr). Nun wäre es 'mal interessant beide Versionen in einem Geschwindigkeitsvergleich gegeneinander antreten zu lassen. Welche Lösung ist da wohl schneller? Gruß aus Hamburg |
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:43 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz