String contains another two strings

前端 未结 17 1589
故里飘歌
故里飘歌 2020-12-15 07:12

Is it possible to have the contain function find if the string contains 2 words or more? This is what I\'m trying to do:

string d = \"You hit someone for 50          


        
17条回答
  •  难免孤独
    2020-12-15 07:34

        public static bool In(this string str, params string[] p)
        {
            foreach (var s in p)
            {
                if (str.Contains(s)) return true;
            }
            return false;
        }
    

提交回复
热议问题