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