Thread
#stdlib
    miha-x64

    miha-x64

    2 years ago
    Shouldn't stdlib contain such a function?
    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 CharSequences is pretty painful in Java, I'd like Kotlin to fix this…
    Dominaezzz

    Dominaezzz

    2 years ago
    Seems it exists for just Strings. (To save other people from searching)
    miha-x64

    miha-x64

    2 years ago
    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 Strings gonna be seriously faster?
    j

    jimn

    2 years ago
    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.