Side note on option 1. English may let you get away with uc'ing to do a comparison. Certain other languages do not. It's just a good I18N habit to get into to always use lower-case to compare. I've never really fully understood this advice from our I18N experts at work, but I take their word for it. Even if that makes me a bit of a cargo-culter. I'm not ashamed to admit it - I'm a unilingual person, so to keep from ticking off our Nordic customers, I'm more than happy to follow this advice. ;-)
Also, side note on option 2 - I think that option 1 is likely to be significantly faster. Benchmark to be sure.
| [reply] |
If you want to give your language experts a counter example, in German, the "sharp-S" / "eszet" letter "ß", compounded of "s" and "z", has no uppercase equivalent and is always written as "SS" when uppercased. For example straße ("street") becomes STRASSE. If you want to match case-insensitively here, you either have to normalize all ß to "ss" before comparing or you can "normalize" by converting to upper case.
But I admit that this is some corner case which is unlikely to affect non-Germans :-)
| [reply] |