devxlogo

January 10, 2017

Check if a String Contains a Phrase

The following snippet will allow you quickly determine whether or not a specified phrase exists in a string: If (!String.IsNullOrEmpty(STRINGTOCHECK.ToString()) && STRINGTOCHECK.ToString().ToLower().Contains(“PHRASETOSEARCHFOR”)){//Found}Else{//Not Found}