• C#数组比较取值


                string strs = string.Empty;
                string[] strArray1 = { "a", "b", "c", "d" };
                string[] strArray2 = { "a", "b", "c", "f", "g" };

                Dictionary<string, string> map = new Dictionary<string, string>();
              
                for (int k = 0; k < strArray1.Length; k++)
                {
          map.Add(strArray1[k], "");
                }

                for (int m = 0; m < strArray2.Length; m++)
                {
          //数组一已经存在的直值是否包含指定的键值,不包含的才取出来
                    if (!map.ContainsKey(strArray2[m]))
                    {
                        strs += strArray2[m] + ",";
                    }
                }

               Response.Write("strArray1字符串数组跟字符串数组strArray2比较,strArray1字符串数组中不含有strArray2数组中的有:" + strs);

  • 相关阅读:
    Common Element in Two Sorted Sets
    Nearest Points on a Plane
    Influencer Finder
    Range of Intervals
    *Common characters
    自定义栈 和装箱,拆箱
    1.Vector(同步)和ArrayList(异步)异同
    STL中的迭代器的使用
    如何优化limit?
    mysql五大引擎之间的区别和优劣之分
  • 原文地址:https://www.cnblogs.com/lsz-blog/p/3178313.html
Copyright © 2020-2023  润新知