Avatar ·

How to compare strings case-insensitively in Kotlin? Java equalsIgnoreCase analog

Hello everyone! I just started learning Kotlin after Java and encountered a simple but annoying problem.\n\nIn Java, I used the `equalsIgnoreCase()` method to compare strings. For example, I'm writing an Android app where I need to check the city entered by the user. The user could type "Moscow", "moscow", or "MOSCOW" — all these variants should be considered the same.\n\nIn Java it looked like this:\n```java\nString userInput = "moscow";\nString city = "Moscow";\nif (city.equalsIgnoreCase(userInput)) {\n // City matched\n}\n```\n\nBut in Kotlin I can't find this method! When I try to write `city.equalsIgnoreCase(userInput)`, the compiler gives an error: "Unresolved reference: equalsIgnoreCase". I tried using `==` for comparison, but it's case-sensitive.