Compare strings disregard case

November 26, 2013 on 7:50 pm | In Programming | No Comments

Found this on one of the many forums looking for a way to find out if a string is present within another one, without having to worry about lower case or upper case.

string title = “STRING”
if (title.IndexOf(“string”, 0, StringComparison.CurrentCultureIgnoreCase) != -1)
{ // The string exists in the original }

No Comments yet »

RSS feed for comments on this post. TrackBack URI

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds. Valid XHTML and CSS. ^Top^