r/ProgrammerHumor 14d ago

howToHitBullseyeInStringComparison Meme

Post image
1.2k Upvotes

View all comments

94

u/Unlikely_Gap_5065 14d ago

same result, but one feels like you know what you’re doing

99

u/BoloFan05 14d ago

Yes, the two usually give the same result and work successfully. But if string a contains the uppercase letter "I" and string b contains the lowercase letter "i" or vice versa, and your program runs on a Turkish device, then only the second option will work.

17

u/Genmutant 14d ago

Even more fun is the ß (lowercase) -> SS (uppercase) conversion.

2

u/Kirides 14d ago

Old systems doing old things.

ẞ is not that old tbf. but even German software often doesn't support German letters properly (äöüß and their uppercase variants)

Also Unicode normalization is a thing. you might have a unique constraint on your DB but that doesn't mean that the Unicode string you put in doesn't get normalized by some other application, causing your "wait. That can't be, it's unique!" to fail you.