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合并,求交集 (保留相同的)的更多相关文章

  1. delphi将两个Strlist合并,求并集

    Function StrList_Merge(StrListA,StrListB:String):String; //将两个Strlist合并,求并集 var SListA,SListB,SListC ...

  2. 两个ArrayList之间求交并补

    class ArraylistCalculate{ // 两个整数集求差集 public ArrayList<Integer> integerArrayListDifference( Ar ...

  3. python 两个list 求交集,并集,差集

    def diff(listA,listB): #求交集的两种方式 retA = [i for i in listA if i in listB] retB = list(set(listA).inte ...

  4. python中对两个 list 求交集,并集和差集

    python中对两个 list 求交集,并集和差集: 1.首先是较为浅白的做法: >>> a=[1,2,3,4,5,6,7,8,9,10] >>> b=[1,2,3 ...

  5. 求两个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 ...

  6. 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 ...

  7. 【转载】C#编程中两个List集合使用Intersect方法求交集

    在C#语言程序设计中,List集合是常用的集合数据类型,在涉及集合类型的运算中,有时候我们需要计算2个List集合中共有的数据,即对2个List集合求交集运算.此时可以使用C#语言提供的Interse ...

  8. sql求两表的并集、交集、非交集、差集、结果集排序

    create table A( id ,) Not null primary key, name ) not null default(''), ) INSERT INTO [A]([name]) V ...

  9. PHP计算两个时间段是否有交集(边界重叠不算)

    优化前的版本: /** * PHP计算两个时间段是否有交集(边界重叠不算) * * @param string $beginTime1 开始时间1 * @param string $endTime1 ...

随机推荐

  1. k8s认证及serviceAccount、userAccount

    1.概述 用kubectl向apiserver发起的命令,采用的是http方式,K8s支持多版本并存. kubectl的认证信息存储在~/.kube/config,所以用curl无法直接获取apis中 ...

  2. promise, async和await

    最开始实现异步的方法:回调函数 method1(function(err, result) { if (err) { throw err; } method2(function(err, result ...

  3. C# 中使用正则表达式 Regex.Matches方法的几个应用[转]

    用于正则表达式的 Regex.Matches静态方法的几种用法: //①正则表达式 = > 匹配字符串 string Text = @"This is a book , this is ...

  4. springboot打包war包部署到tomcat

    1.pom.xml修改处 <modelVersion>4.0.0</modelVersion><groupId>com.xx</groupId>< ...

  5. 你真的了解new function(){} 和 function(){}()吗?

    只要 new 表达式之后的 constructor 返回(return)一个引用对象(数组,对象,函数等),都将覆盖new创建的匿名对象,如果返回(return)一个原始类型(无 return 时其实 ...

  6. 使用css让表头固定的方法

    1.可以使用display: table; width: 100%; table-layout: fixed; table-layout: fixed;设置表格布局算法.tableLayout 属性用 ...

  7. javascript字符串机油

    1.创建字符串和数组的方法 1.1创建字符串的方法 a.直接数量:var str=“: b.字符串对象创建:新字符串(“): 1.2创建阵列的方法 a.var.arr=要素…. b.var arr=n ...

  8. docker 第四篇 网络

    安装docker以后自动添加三种网络方式 bridge: 表示桥接网络 (在本地自动创建一个软交换机) host: 表示让容器使用宿主机的网络名称空间 none: 表示没有网络 不能执行网络通信. 创 ...

  9. 使用pycharm 编写代码 并在远程主机上运行

    一 要求 远程主机有python解释器 二 在菜单栏,File -> Settings… -> Project ×× -> Project Interpreter,点击右侧 Add按 ...

  10. RabbitMQ的持久化

      RabbitMQ的持久化主要体现在三个方面,即交换机持久化,队列持久化及消息持久化 注意,因公司使用php-amqplib来实现RabbitMQ,故之后举例说明的代码均使用的php-amqplib ...