在 Kotlin 中比较 String
值的 Java equalsIgnoreCase
的等价物是什么?
我使用过 equals
但它不区分大小写。
最佳答案
你可以使用 equals
但指定 ignoreCase
参数:
"example".equals("EXAMPLE", ignoreCase = true)
https://stackoverflow.com/questions/50198067/
相关文章:
android - 警告 "Kotlin plugin version is not the sam
kotlin - 字符串插值在 Kotlin 中是如何工作的?
gradle - 如何使用 kotlinscript DSL (build.gradle.kts)
spring - Kotlin 和 Spring Boot @ConfigurationProper
constructor - Kotlin 数据类可以有多个构造函数吗?
list - 在 Kotlin 中,如何在迭代时修改列表的内容
variables - 在 Kotlin 中一次定义多个变量(例如 Java : String x,