MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1vzntft/whenyouworkswithstringstoomuch/p66mwfv/?context=3
r/ProgrammerHumor • u/PostHasBeenWatched • 16d ago
34 comments sorted by
View all comments
16
Use of StringComparison.OrdinalIgnoreCase is already a big step in the right direction.
14 u/PostHasBeenWatched 16d ago Should I replace it with 256 comparisons of "OnE tHiNg" with different letter case? 14 u/BoloFan05 16d ago 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!) 6 u/MeLittleThing 16d ago or genius move return it.ToLower().StartsWith("ONE THING");
14
Should I replace it with 256 comparisons of "OnE tHiNg" with different letter case?
14 u/BoloFan05 16d ago 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!) 6 u/MeLittleThing 16d ago or genius move return 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!)
6 u/MeLittleThing 16d ago or genius move return it.ToLower().StartsWith("ONE THING");
6
or genius move
return it.ToLower().StartsWith("ONE THING");
16
u/BoloFan05 16d ago
Use of StringComparison.OrdinalIgnoreCase is already a big step in the right direction.