In C #, String.contains is case sensitive, so if you want to be in C # Using String.contains to determine whether a string contains a keyword keyword, it is less efficient to convert this string and keyword to lowercase and then call contains.
A good way to do this is to use the String.index () method, and then specify the lookup procedure by StringComparison.OrdinalIgnoreCase to ignore the case, as the following code example reads:
string title = "string";
BOOL contains = title. IndexOf ("string", StringComparison.OrdinalIgnoreCase) >= 0;
If you need to use it extensively in your project, consider encapsulating it as a method to add to the static tool class StringUtils.cs, or simply write an extension of the string class
public static bool Contains (this string source, string Tocheck, StringComparison comp) {return
source. IndexOf (Tocheck, comp) >= 0;
}