fun CharSequence.indexOfAny( chars: CharArray, startIndex: Int = 0, ignoreCase: Boolean = false ): Int
Finds the index of the first occurrence of any of the specified chars in this char sequence, starting from the specified startIndex and optionally ignoring the case.
ignoreCase
- true
to ignore character case when matching a character. By default false
.
Return An index of the first occurrence of matched character from chars or -1 if none of chars are found.
fun CharSequence.indexOfAny( strings: Collection<String>, startIndex: Int = 0, ignoreCase: Boolean = false ): Int
Finds the index of the first occurrence of any of the specified strings in this char sequence, starting from the specified startIndex and optionally ignoring the case.
ignoreCase
- true
to ignore character case when matching a string. By default false
.
Return
An index of the first occurrence of matched string from strings or -1 if none of strings are found.
To avoid ambiguous results when strings in strings have characters in common, this method proceeds from the beginning to the end of this string, and finds at each position the first element in strings that matches this string at that position.
© 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/index-of-any.html