3 ms·
const string input = "interesting"; bool comparison = input.ToUpper() == "INTERESTING"; Console.WriteLine("These things are equal: " + comparison); Consol
by shultays 1y ago
const string input = "interesting";
bool comparison = input.ToUpper() == "INTERESTING";
Console.WriteLine("These things are equal: " + comparison);
Console.ReadLine();
Is this a realistic scenario? Changing case of a string and comparing it to something else? Running some kind of operations & logic on a string that is meant for user?
If you are doing such things then it looks more like a code smell.
- _1tem 1y agoOne use case I can think of: email string normalization during login. If your string localization is wrong, simple things like login can fail. Edit: another use case: full text case insensitive searching of documents
- NooneAtAll3 1y agoas the other commenter says - normalization right now I'm tinkering an old game that transforms all text inputs to uppercase ascii
- nemetroid 1y agoCase insensitivity is a code smell?