上一篇 | 下一篇

如何避免TStringList里的Items雷同?

发布: 2008-6-26 17:27 | 作者: admin | 来源: | 查看: 0次

利用属性Duplicates来做避免:

var

sl : TStringList;

begin

sl := TStringList.Create;

with sl do

begin

Sorted := True;

Duplicates := dupIgnore;

//

// 在这里添加 items,所有雷同的会忽略

//

Add(Input1.text);

end;

ListBox1.Items.Assign(sl);

sl.Free;

end;

字号: | 推荐给好友

评分:0

我来说两句