删除delphi组件TStringlist中的重复项目


本文整理自网络,侵删。

 
procedure RemoveDuplicates(const stringList : TStringList) ;
 var
   buffer: TStringList;
   cnt: Integer;
 begin
   stringList.Sort;
   buffer := TStringList.Create;
   try
     buffer.Sorted := True;
     buffer.Duplicates := dupIgnore;
     buffer.BeginUpdate;
     for cnt := 0 to stringList.Count - 1 do
       buffer.Add(stringList[cnt]) ;
     buffer.EndUpdate;
     stringList.Assign(buffer) ;
   finally
     FreeandNil(buffer) ;
   end;
 end;

相关阅读 >>

Delphi fmx中获取窗口比例

windows7下使用Delphi7的方法

Delphi 如何把字符串覆给数组

Delphi 数据库重置用户密码制作

Delphi memo1自动循环上下滚屏

Delphi切换指定窗口到最前并获得焦点

Delphi closehandle的解释

Delphi system.sysutils.tmarshaller 与 system.tmarshal

Delphi 时间差函数及部分字符串与日期时间相互转换的函数

Delphi 写开关防火墙代码

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...