Geeks With Blogs

News My Blog has been MOVED to https://mfreidge.wordpress.com
Michael Freidgeim's OLD Blog My Blog has been MOVED to https://mfreidge.wordpress.com

/// <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 on Thursday, May 12, 2011 6:27 AM .Net Framework | Back to top


Comments on this post: IsStringContainsAnyFromList helper function

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Michael Freidgeim | Powered by: GeeksWithBlogs.net