zoukankan      html  css  js  c++  java
  • autocad.net QQ群:193522571 判断string中是否包含集合中所有的字符串

            #region Contains重载函数
            /// <summary>
            /// 判断块说明中是否包含指定词组
            /// </summary>
            /// <param name="str">父字符串</param>
            /// <param name="strs">指定关键词的集合</param>
            /// <param name="containAll">是否包含全部才返回true</param>
            /// <returns>返回bool类型</returns>
            public static bool Contains(this string str, List<string> strs,bool containAll)
            {
                if (!containAll)
                    foreach (string s in strs)
                    {
                        if (str.Contains(s))
                            return true;
                    }
                else if(containAll)
                {
                    foreach (string s in strs)
                    {
                        if (!str.Contains(s))
                            return false;
                    }
                    return true;
                }
                return false;
            }
            #endregion
  • 相关阅读:
    shell test条件判断
    shell 变量
    shell 流程结构
    shell 正则表达式
    shell脚本常用参数
    snmp 简单的网络管理协议
    linux
    nmap
    git 基础操作
    linux 下 svn 更新代码
  • 原文地址:https://www.cnblogs.com/swtool/p/3648495.html
Copyright © 2011-2022 走看看