W3cubDocs

/Kotlin

indexOf

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
fun CharSequence.indexOf(
    char: Char, 
    startIndex: Int = 0, 
    ignoreCase: Boolean = false
): Int

Returns the index within this string of the first occurrence of the specified character, starting from the specified startIndex.

Parameters

ignoreCase - true to ignore character case when matching a character. By default false.

Return An index of the first occurrence of char or -1 if none is found.

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
fun CharSequence.indexOf(
    string: String, 
    startIndex: Int = 0, 
    ignoreCase: Boolean = false
): Int

Returns the index within this char sequence of the first occurrence of the specified string, starting from the specified startIndex.

Parameters

ignoreCase - true to ignore character case when matching a string. By default false.

Return An index of the first occurrence of string or -1 if none is found.

© 2010–2019 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/index-of.html