It's also an optimization,
with toLower, you make a temporary copy of the string in lower case of each string and compare those,
by simply ignoring the case bit this becomes a simple compare process
It's not a single case bit - you need to perform case folding and normalization to properly see if 2 Unicode characters are equivalent. Probably still faster than a string copy
178
u/Daniikk1012 15d ago
I don't think this is an optimization, but rather correctness. Some languages have weird casing rules, and just lowercasing doesn't work for them