IsStringContainsAnyFromList helper function

/// <summary>
       /// Returns true, if  string contains any of substring from the list (case insensitive)
       /// See similar (with SqlLikeMatch support) in ResponseMessagePatternsCache
       /// </summary>
       /// <returns></returns>
       public static bool IsStringContainsAnyFromList( string stringToSearch,List<String> stringsToFind)
       {
           //TODO: create overloads with exact match  or case sencitive
           if (stringsToFind.IsNullOrEmpty())
           { return false; }
           else
           {
               stringToSearch = stringToSearch.ToUpper();
               return stringsToFind.Where(pattern => stringToSearch.Contains(pattern.ToUpper())).Count() > 0;
           }
       }
 

posted @ Thursday, May 12, 2011 6:27 AM
Print

Comments on this entry:

No comments posted yet.

Your comment:



(not displayed)


 
 
 
 
 

Live Comment Preview:

 
«May»
SunMonTueWedThuFriSat
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789