if not adlist.Find(id,index) then
adlist.AddObject(id,ad);
else
begin
adlist.Delete(i);
adlist.AddObject(id,ad);
end;//如果标识已存在,则删除该对应元素.如不存在,直接增加,//adlist为TStringList对象,id为要增加的标识符,ad为要增加的对像运行后,adlist中仍有重复的内容?大家有什么好的办法解决吗/
adlist.AddObject(id,ad);
else
begin
adlist.Delete(i);
adlist.AddObject(id,ad);
end;//如果标识已存在,则删除该对应元素.如不存在,直接增加,//adlist为TStringList对象,id为要增加的标识符,ad为要增加的对像运行后,adlist中仍有重复的内容?大家有什么好的办法解决吗/
这个有问题吧
查资料了,那个find用的是折半查找,前面加个sort就不会不出重复记录了
不过还是谢谢你的提醒,等我结贴吧拿分吧!
忽略重复值