We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Check Whether a String Contains Another String

Submitted by: Srinath M S(srinath_ms@yahoo.com)

Friday Mar 2nd 2018 by Srinath M S

Language: .NET, Expertise: Intermediate - Learn how to perform a valid string comparison by ignoring the case.

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) = 0;
Mobile Site | Full Site
Copyright 2018 © QuinStreet Inc. All Rights Reserved