https://kotlinlang.org logo
#stdlib
Title
m

miha-x64

04/17/2020, 8:11 PM
Shouldn't stdlib contain such a function?
Copy code
fun CharSequence.equalsIgnoreCase(that: CharSequence): Boolean {
    val len = length
    if (that.length != len) return false
    return regionMatches(0, that, 0, len, ignoreCase = true)
}
Dealing with `CharSequence`s is pretty painful in Java, I'd like Kotlin to fix this…
d

Dominaezzz

04/17/2020, 8:36 PM
Seems it exists for just `String`s. (To save other people from searching)
m

miha-x64

04/18/2020, 8:34 AM
Yep, but I'm, gonna have at least
ConcatStr(left: CharSequence, joiner: Char, right: CharSequence, capitalize: Boolean)
and
Slice(where: CharSequence, from: Int, to: Int)
Or this is bad for data locality and `String`s gonna be seriously faster?
👌 1
j

jimn

04/23/2020, 8:09 PM
CharSequence is an interface, the virtuals have proven expensive in native code not long ago. for certain string functions upstream of charsequence use there is specific code to check if it is a String to accelerate as a result of the issues raised.