从TStringList删除重复项

2020-04-09

参考文献:http://docwiki.embarcadero.com/Libraries/XE2/en/System.Classes.TStringList.Duplicates


去重一定要加上排序:

channelList.Sorted := true
var F: TField; channelList := TStringList.Create; channelList.Sorted := True; channelList.Duplicates := dupIgnore; try    dataset.First;    F := dataset.FieldByName('CHANNEL_INT');    while not dataset.EOF do    begin       channelList.Add(F.AsString);       dataset.Next;    end;





阅读135