mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 08:40:25 +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;
|
function IndexOf(const S: string): Integer; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure Deduplicate(AStrings: TStringList);
|
||||||
|
|
||||||
implementation
|
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 }
|
{ TDictionaryStringList }
|
||||||
|
|
||||||
constructor TDictionaryStringList.Create;
|
constructor TDictionaryStringList.Create;
|
||||||
|
Loading…
Reference in New Issue
Block a user