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
原文地址:https://www.cnblogs.com/swtool/p/3648495.html