Showing posts with label Strings. Show all posts
Showing posts with label Strings. Show all posts

Jun 12, 2009

Howto avoid having to use ToUpper() in string comparisons

Instead of using:

if (myString.ToUpper() == theirString.ToUpper) { ... }

Use this:

if( myString.Equals( theirString, StringComparison.OrdinalIgnoreCase ) { ... }


Thanks to: Ralph