delphi将两个Strlist合并,求交集 (保留相同的)
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合并,求交集 (保留相同的)的更多相关文章
- delphi将两个Strlist合并,求并集
Function StrList_Merge(StrListA,StrListB:String):String; //将两个Strlist合并,求并集 var SListA,SListB,SListC ...
- 两个ArrayList之间求交并补
class ArraylistCalculate{ // 两个整数集求差集 public ArrayList<Integer> integerArrayListDifference( Ar ...
- python 两个list 求交集,并集,差集
def diff(listA,listB): #求交集的两种方式 retA = [i for i in listA if i in listB] retB = list(set(listA).inte ...
- python中对两个 list 求交集,并集和差集
python中对两个 list 求交集,并集和差集: 1.首先是较为浅白的做法: >>> a=[1,2,3,4,5,6,7,8,9,10] >>> b=[1,2,3 ...
- 求两个Linux文本文件的交集、差集、并集
一.交集 sort a.txt b.txt | uniq -d 二.并集 sort a.txt b.txt | uniq 三.差集 a.txt-b.txt: sort a.txt b.txt b.tx ...
- Linux 两个文件求交集、并集、差集
一.交集 sort a.txt b.txt | uniq -d 二.并集 sort a.txt b.txt | uniq 三.差集 a.txt-b.txt: sort a.txt b.txt b.tx ...
- 【转载】C#编程中两个List集合使用Intersect方法求交集
在C#语言程序设计中,List集合是常用的集合数据类型,在涉及集合类型的运算中,有时候我们需要计算2个List集合中共有的数据,即对2个List集合求交集运算.此时可以使用C#语言提供的Interse ...
- sql求两表的并集、交集、非交集、差集、结果集排序
create table A( id ,) Not null primary key, name ) not null default(''), ) INSERT INTO [A]([name]) V ...
- PHP计算两个时间段是否有交集(边界重叠不算)
优化前的版本: /** * PHP计算两个时间段是否有交集(边界重叠不算) * * @param string $beginTime1 开始时间1 * @param string $endTime1 ...
随机推荐
- xpath的一些常用使用
xml文档<html> <head> <title>My page</title> </head> <body> <h2& ...
- urllib基础
import urllib.request # urlretrieve(网址,本地路径) 直接下载网页到本地 urllib.request.urlretrieve("http://www.b ...
- 洛谷P1087 FBI树
P1087 FBI树题解: 看到这个题,我想到了线段树!(毕竟刚搞完st表...) 当然,题解中有位大佬也用的线段树,但是当时看的时候我看见了9个if,当场去世. 那么这是一个不用暴力的线段树,且简单 ...
- Python 异常处理与反射机制
Python 的创始人为吉多·范罗苏姆(Guido van Rossum).1989年的圣诞节期间,吉多·范罗苏姆为了在阿姆斯特丹打发时间,决心开发一个新的脚本解释程序,作为ABC语言的一种继承.Py ...
- 【原创】大叔经验分享(79)mysql内存设置
mysql内存设置,首先要知道当前的设置 MySQL [(none)]> show variables like '%buffer%'; +--------------------------- ...
- Java通过JDBC连接SQL Server
下载Microsoft JDBC Driver 4.0 for SQL Server 在这里下载:http://www.microsoft.com/zh-cn/download/details.asp ...
- B树,B+树的原理及区别
如图所示,区别有以下两点: 1. B+树中只有叶子节点会带有指向记录的指针(ROWID),而B树则所有节点都带有,在内部节点出现的索引项不会再出现在叶子节点中. 2. B+树中所有叶子节点都是通过指针 ...
- 【51nod2026】Gcd and Lcm(杜教筛)
题目传送门:51nod 我们可以先观察一下这个$f(x)=\sum_{d|x}\mu(d) \cdot d$. 首先它是个积性函数,并且$f(p^k)=1-p \ (k>0)$,这说明函数$f( ...
- python实现IP地址转换为32位二进制
python实现IP地址转换为32位二进制 #!/usr/bin/env python # -*- coding:utf-8 -*- class IpAddrConverter(object): de ...
- const成员函数和const对象
从成员函数说起 在说const成员函数之前,先说一下普通成员函数,其实每个成员函数都有一个隐形的入参:T *const this. int getValue(T *const this) { retu ...