mirror of https://gitlab.com/basile.b/dexed.git
added funct to eliminate dups in TStrings
This commit is contained in:
parent
4555d43bd3
commit
0aaebbb4e7
|
@ -230,6 +230,10 @@ type
|
|||
*)
|
||||
function isStringDisabled(const str: string): boolean;
|
||||
|
||||
(**
|
||||
* Deletes the duplicates in a TStrings instance.
|
||||
*)
|
||||
procedure deleteDups(str: TStrings);
|
||||
|
||||
|
||||
implementation
|
||||
|
@ -1050,6 +1054,19 @@ begin
|
|||
result := true;
|
||||
end;
|
||||
|
||||
procedure deleteDups(str: TStrings);
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
{$HINTS OFF}
|
||||
if str = nil then exit;
|
||||
for i:= str.Count-1 downto 0 do
|
||||
// if less than 0 -> not found -> unsigned -> greater than current index.
|
||||
if cardinal(str.IndexOf(str.Strings[i])) < i then
|
||||
str.Delete(i);
|
||||
{$HINTS ON}
|
||||
end;
|
||||
|
||||
initialization
|
||||
registerClasses([TCEPersistentShortcut]);
|
||||
end.
|
||||
|
|
Loading…
Reference in New Issue