delphi 去除 TStringList 重复项


本文整理自网络,侵删。

 
//去除 TStringList 重复项
procedure RemoveDuplicates(const AStrs: TStringList);
var
    Buf: TStringList;
    Idx: Integer;
begin
    AStrs.Sort;
    Buf := TStringList.Create;
    try
        Buf.Sorted := True;
        Buf.Duplicates := dupIgnore;
        Buf.BeginUpdate;
        for Idx := 0 to AStrs.Count - 1 do begin
           Buf.Add(AStrs[Idx]) ;
        end;
        Buf.EndUpdate;
        AStrs.Assign(Buf) ;
    finally
        FreeandNil(Buf) ;
    end;
end;

http://www.delphifmx.com/node/29

相关阅读 >>

Delphi 一个绘制虚线的非常规函数(常规方法,打印机上绘制不出虚线)

Delphi tapplication大全

adoquery 实现获取数据库所有表名

Delphi显示 jpg、png、gif 图片及 gif 动画

Delphi截取字符串的方法

Delphi操作word中的表

Delphi字符串、数组操作函数

Delphi android device information

Delphi双进程监控

Delphi 如何从dll中检索导出函数的列表

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



打赏

取消

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

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

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

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

评论

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