2 ms·
The usual goal is to apply a consistent transform though, to smooth out interpretation differences - i.e. when looking for command input I either lowercase or u
by XorNot 13y ago
The usual goal is to apply a consistent transform though, to smooth out interpretation differences - i.e. when looking for command input I either lowercase or uppercase things to smooth over the fact that "yes" "YES" "Yes" are all completely valid ways of saying the same thing with those characters.
If there's only one way of expressing the thing - i.e. a single chinese character - then it would be valid to do nothing. It's just in english "y" and "Y" might change context, but as far as computer input is generally concerned they are the same thing.
- TorKlingberg 13y agoFor that use case it is better to compare case insensitively with "yes" instead of converting the input to lower case first.
- zokier 13y agoHow do you do case-insensitive comparison without normalizing the case of the operands?
- gnaritas 13y agoMost string compare routines in the library offer a case insensitive compare option already, you don't have to normalize it.
- asveikau 13y agoIf you can compare case-insensitively then you (or the library you call into) must be aware of case and you face the exact same problems. It's a pretty good thought exercise to attempt writing your own Unicode-aware case insensitive string compare. A lot of people call into libraries for this stuff without realizing how complex the problem gets.
- ianburrell 13y agoTo compare strings case-insensitively, you want case-folding instead of lowercase or uppercase. Unicode defines case-folding for comparing strings. There are enough complexities with case, like characters that don't have other case or multiple mappings, that it can't be correctly used for comparison.