Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: .NET
Expertise: Intermediate
Mar 2, 2018

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


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) = 0;
Srinath M S
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date