3 ms·
> string-compare-case-insensitive(x, y) => true // Right way what is inside that function?
by heurisko 4y ago
> string-compare-case-insensitive(x, y) => true // Right way
what is inside that function?
- amenghra 4y agofunc string-compare-case-insensitive(x, y) { return lower(x) == lower(y) ? lower(x) == lower(y) : lower(x) == lower(y); } /s More seriously, if you want to learn about this, one place is to look at OpenJDK's sources. E.g. here: https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/lang/String.java#L1978 https://github.com/openjdk/jdk/blob/master/src/java.base/sha... which calls: https://github.com/openjdk/jdk/blob/17283cfe4c697e2118f19992a6e87dbee268061e/src/java.base/share/classes/java/lang/String.java#L2141 https://github.com/openjdk/jdk/blob/17283cfe4c697e2118f19992... and https://github.com/openjdk/jdk/blob/17283cfe4c697e2118f19992a6e87dbee268061e/src/java.base/share/classes/java/lang/String.java#L2230 https://github.com/openjdk/jdk/blob/17283cfe4c697e2118f19992...
- jph 4y agoWhat's inside that function is Unicode case folding and non-deterministic collation, such as ICU, or its equivalent. See https://icu.unicode.org https://icu.unicode.org