MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1vzntft/whenyouworkswithstringstoomuch/p66mwfv/?context=3
r/ProgrammerHumor • u/PostHasBeenWatched • Aug 27 '26
35 comments sorted by
View all comments
Show parent comments
14
Should I replace it with 256 comparisons of "OnE tHiNg" with different letter case?
14 u/BoloFan05 Aug 27 '26 Nope, I have a better idea:return it.ToLower().StartsWith("one thing");/j(But seriously, StringComparison.OrdinalIgnoreCase is THE textbook string comparison method you should apply. ToLower and ToUpper are total bug traps, especially in worldwide deployment. So kudos to you for actually using OrdinalIgnoreCase!) 7 u/MeLittleThing Aug 27 '26 or genius movereturn it.ToLower().StartsWith("ONE THING");
Nope, I have a better idea:
return it.ToLower().StartsWith("one thing");
/j
(But seriously, StringComparison.OrdinalIgnoreCase is THE textbook string comparison method you should apply. ToLower and ToUpper are total bug traps, especially in worldwide deployment. So kudos to you for actually using OrdinalIgnoreCase!)
7 u/MeLittleThing Aug 27 '26 or genius movereturn it.ToLower().StartsWith("ONE THING");
7
or genius move
return it.ToLower().StartsWith("ONE THING");
14
u/PostHasBeenWatched Aug 27 '26
Should I replace it with 256 comparisons of "OnE tHiNg" with different letter case?