- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
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