3 ms·
> Write a program which accepts a letter and display it in uppercase That task is a lot harder than it sounds, given that casing is locale-specific. In a Turki
by 3PS 3y ago
> Write a program which accepts a letter and display it in uppercase
That task is a lot harder than it sounds, given that casing is locale-specific. In a Turkish locale for example, I would expect a lowercase "i" to be converted to U+0130 "İ" instead of "I" like in en-US.
And then there's the whole ambiguity around the word "letter". Is a letter a single code point, or a grapheme cluster? What if someone passes in an emoji? With multiple zero-width joiners? Better make sure your dependencies are up to date so you know what's a single letter and what's too many...
- sverona 3y agoThis is clearly not what GP meant, and although i18n is rather complicated, I suspect that pointing all these things out to a junior dev in an interview would actually cause them to BSOD. The only correct answer to that question if you take i18n into account is "I'm not qualified to write that off the top of my head."
- basil-rash 3y agoThe answer is clearly text-transform: uppercase, given the poster knows HTML (which more or less implies CSS)