
Check Whether a String Contains Another String
Often, we have to do a string comparison by ignoring the case, or the results end up being wrong. The StringComparison enum provides the “ordinalignorecase” member that allows you to do this. See below for an example. string searchString = “John”; string completeString = “johnDoe”;bool exists = completeString.IndexOf(searchString, StringComparison.OrdinalIgnoreCase) =