码迷,mamicode.com
首页 > Windows程序 > 详细

delphi将两个Strlist合并,求交集 (保留相同的)

时间:2017-07-25 15:46:34      阅读:292      评论:0      收藏:0      [点我收藏+]

标签:var   for   add   合并   保留   .com   相同   cti   list   

Function StrList_Join(StrListA,StrListB:String):String; //将两个Strlist合并,求交集 (保留相同的)
var SListA,SListB,SListC:TStringList;
i:Integer;
begin
Result := ‘‘;
Try
SListA := TStringList.Create;
SListB := TStringList.Create;
SListC := TStringList.Create;
SListA.CommaText := StrListA; SListB.CommaText := StrListB;
for i:=0 to SListA.Count-1 do begin
if SListB.IndexOf(SListA[i])>=0 then SListC.Add(SListA[i]);
end;
Result := SListC.CommaText;
Finally
FreeAndNil(SListA); FreeAndNil(SListB); FreeAndNil(SListC);
end;
end;

delphi将两个Strlist合并,求交集 (保留相同的)

标签:var   for   add   合并   保留   .com   相同   cti   list   

原文地址:http://www.cnblogs.com/xwgcxk/p/7233788.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!