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组件TStringlist中的重复项目
最新推荐文章于 2022-07-13 15:21:58 发布
本文介绍了一种使用Delphi或Pascal实现的去除字符串列表中重复项的方法。通过排序和临时列表来忽略重复项,最后将去重后的列表赋值回原列表。
2529

被折叠的 条评论
为什么被折叠?



