mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 15:19:35 +02:00
LazUtils: Add a Deduplicate procedure for DictionaryStringList. Issue #27249, patch from Antônio Galvão.
git-svn-id: trunk@47321 -
This commit is contained in:
parent
ac935867c3
commit
9bbe6f00a1
@ -53,9 +53,25 @@ type
|
||||
function IndexOf(const S: string): Integer; override;
|
||||
end;
|
||||
|
||||
procedure Deduplicate(AStrings: TStringList);
|
||||
|
||||
implementation
|
||||
|
||||
procedure Deduplicate(AStrings: TStringList);
|
||||
var
|
||||
DSL :TDictionaryStringList;
|
||||
begin
|
||||
if AStrings.OwnsObjects then
|
||||
raise Exception.Create('Deduplicate: OwnsObjects in AStrings is not supported.');
|
||||
DSL := TDictionaryStringList.Create;
|
||||
try
|
||||
DSL.Assign(AStrings);
|
||||
AStrings.Assign(DSL);
|
||||
finally
|
||||
DSL.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TDictionaryStringList }
|
||||
|
||||
constructor TDictionaryStringList.Create;
|
||||
|
Loading…
Reference in New Issue
Block a user