3 ms·
Mechanically abbreviating strings is likely to have nasty corner cases. Avoid if at all possible. There are fancy Unicode corner cases, like the flags (cutting
by tialaramex 7y ago
Mechanically abbreviating strings is likely to have nasty corner cases. Avoid if at all possible.
There are fancy Unicode corner cases, like the flags (cutting a flag emoji in half doesn't get you half a flag it gets you one half of the flag's country code identifier) but there are plenty of corner cases already in ASCII.
Abbreviating "Give all the money to Samantha's parents to hold in trust" as "Give all the money to Sam" doesn't involve any scary modern encoding, just the problem that this isn't how human languages work.
- Arnt 7y agoCan you suggest a relevant nasty corner case? Consider an unbounded input string (generally less than 1k, but sometimes more than 100k), a phone display large enough to display, say, 80-120 glyphs, and a mechanical abbreviation to a few hundred codepoints soon after input, before all expensive processing. What are the nasty corner cases?