【发布时间】:2013-07-27 07:29:58
【问题描述】:
我必须比较2个stringlist,我想知道在第二个stringlist中搜索第一个stringlist是唯一还是推荐的版本来执行这个问题
我的代码会是这样的
var
aFirstStrList: TStringList ;
aSecondStringList: TStringList;
MissingElement_firstElement_not_inside_second: TStringList;
MissingElement_SecondElement_not_inside_First: TStringList;
...
for i := 0 to aFirstStrList.Count - 1 do
begin
if aSecondStringList.IndexOf(aFirstStrList[i] < 0 ) then
begin
// react on not found elements
....
MissingElement_firstElement_not_inside_second.add(...);
end;
end;
// and now same code just opposite search direction ....
....
【问题讨论】:
-
这取决于...请定义“差异”。想想
a;b和a;a。在这种情况下,您希望得到什么结果?
标签: delphi comparison tstringlist