删除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 tbutton.onclick 匿名函数用法

Delphi2010安装twordapplication控件

Delphi通过spcomm com口发短信包括pud编码解码

Delphi 锁住listview防止刷新

Delphi adoquery1数据表参数调用

Delphi 解析json生成json

Delphi stringgrid如何清空

Delphi xe 启动关闭start page 页错误提示

Delphi web service 多表提交的事务管理

Delphi 获取百度注册页面验证码图片的源代码

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



打赏

取消

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

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

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

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

评论

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