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;
|
请发表评论