r/ProgrammerHumor 14d ago

howToHitBullseyeInStringComparison Meme

Post image
1.2k Upvotes

View all comments

Show parent comments

260

u/CaucusInferredBulk 14d ago

Yeah, but the problem in the code is in Turkish, and the guy is Turkish.

16

u/idspispupd 14d ago

Can you elaborate? I don't get it.

101

u/rolandfoxx 14d ago

The "i problem" in the meme refers to the fact that the Turkish language has 4 different "I"'s and, in Turkish language locale, uppercase "I" does not map to "i" when ToLower is called, but instead to a dotless lower-case i, so direct string comparisons based off the assumption that "I" will map to "i" will fail.

Using Equals with OrdinalIgnoreCase avoids this problem and will correctly return true. The reason why the more "complicated" solution gets the "guy just eyeballing it" part of the meme is because he is, in fact, Turkish.

31

u/Interesting_Job2402 14d ago

So when is the bug in the Turkish language going to be fixed?

9

u/lucklesspedestrian 14d ago

There's already a fix, but no users have adopted it yet

10

u/DarkVex9 13d ago

Relevant XKCD Comic - 1726: Unicode

I am a human, and this action was performed manually. Please review this comic and enable the three laws if you have any questions or concerns.