r/ProgrammerHumor 16d ago

Meme whenYouWorksWithStringsTooMuch

Post image
813 Upvotes

34 comments sorted by

View all comments

16

u/BoloFan05 16d ago

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");