问题:
如何避免TStringList里的Items雷同?
解答:
利用属性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;