W3cubDocs

/Kotlin

lastIndexOf

Platform and version requirements: JS (1.4), Native (1.4)
fun lastIndexOf(string: String): Int

Returns the index within this string builder of the last occurrence of the specified string. The last occurrence of empty string "" is considered to be at the index equal to this.length.

Returns -1 if the specified string does not occur in this string builder.

Platform and version requirements: JS (1.4), Native (1.4)
fun lastIndexOf(string: String, startIndex: Int): Int

Returns the index within this string builder of the last occurrence of the specified string, starting from the specified startIndex toward the beginning.

Returns -1 if the specified string does not occur in this string builder starting at the specified startIndex.

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/-string-builder/last-index-of.html