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;
调用:
RemoveDuplicates(memo1.text)
标签:delphi
发表评论