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 winapi: getwindowtextlength - 获取窗口标题长度

Delphi format中的换行符号是什么

Delphi 通用程序自动更新升级

Delphi tms web core twebsocketclient

Delphi中accesss实现树形结构查询系统

Delphi关于tjpegimage的使用(bmp\ jpg格式转换)

Delphi api 函数: getcursorpos 与转换

Delphi system.sysutils.tmarshaller 与 system.tmarshal

Delphi xe10 麦克风、摄像头操作

Delphi 判断com端口是否存在

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



打赏

取消

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

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

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

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

评论

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