3 ms·
> Java converts a 15-character mixed-case string to lowercase at about 11,600 conversions per millisecond [...] Converting two strings to lowercase and compari
by zamalek 13y ago
> Java converts a 15-character mixed-case string to lowercase at about 11,600 conversions per millisecond [...]
Converting two strings to lowercase and comparing those is not case insensitivity. I present to you 4 characters: I, ı, İ and i. They break your application.
And that's where case-insensitivity becomes evil. I have no facts (other than code reviews I do) to back this up; but the amount of developers who don't understand case-insensitivity is hideously dangerous. Where I work I would venture to say I correct 95% of developers from this (C#):
a.ToLower() == b.ToLower()
To this:
a.Equals(b, StringComparison.CurrentCultureIgnoreCase)
Even that flops with the Turkish Is though - what you need there is "accent insensitivity".
I fundamentally agree with the argument that most things should be case insensitive - I just think that the task cannot be trusted to most of the developers today. Even though I am extremely well versed in globalization even I mess up the majority of the time. Case insensitivity is HARD.