TheSwamp

Code Red => .NET => Topic started by: nobody on June 21, 2016, 01:24:36 AM

Title: ToUpper() vs StringComparison.InvariantCultureIgnoreCase
Post by: nobody on June 21, 2016, 01:24:36 AM
ToUpper() vs StringComparison.InvariantCultureIgnoreCase....was going through some old c# docs and just saw this... I use ToUpper() all the time as a lazy way to compare strings...but the document I was reading mentions using the string comparison instead... I can't think of why it would matter.... thoughts?
Title: Re: ToUpper() vs StringComparison.InvariantCultureIgnoreCase
Post by: kdub_nz on June 21, 2016, 01:54:50 AM

Was that related to something like 'The Turkey Test ' ?
Title: Re: ToUpper() vs StringComparison.InvariantCultureIgnoreCase
Post by: nobody on June 21, 2016, 02:03:15 AM

Was that related to something like 'The Turkey Test ' ?

That's interesting... had to look it up...never heard of it before but makes for some good reading. Not sure if that's what the author referred to though. They simply said it's just better.
Title: Re: ToUpper() vs StringComparison.InvariantCultureIgnoreCase
Post by: Andrey Bushman on June 22, 2016, 04:27:39 PM
Note, that ToLower() is "better" than ToUpper() for comparring of strings  because some chars in some languages haven't upper variant.
Title: Re: ToUpper() vs StringComparison.InvariantCultureIgnoreCase
Post by: nobody on June 25, 2016, 11:01:43 PM
Note, that ToLower() is "better" than ToUpper() for comparring of strings  because some chars in some languages haven't upper variant.

Thanks Andrey! nice tip