Fix lastIndexOfOrNull

This commit is contained in:
Sergey Rostov
2020-05-07 16:56:36 +03:00
parent c604ef1255
commit cf4ad1908b
2 changed files with 3 additions and 3 deletions
@@ -95,7 +95,7 @@ private val constantMap = ConcurrentHashMap<Function0<*>, Any>()
fun String.indexOfOrNull(char: Char, startIndex: Int = 0, ignoreCase: Boolean = false): Int? =
indexOf(char, startIndex, ignoreCase).takeIf { it >= 0 }
fun String.lastIndexOfOrNull(char: Char, startIndex: Int = 0, ignoreCase: Boolean = false): Int? =
fun String.lastIndexOfOrNull(char: Char, startIndex: Int = lastIndex, ignoreCase: Boolean = false): Int? =
lastIndexOf(char, startIndex, ignoreCase).takeIf { it >= 0 }
inline fun <T, R : Any> Iterable<T>.firstNotNullResult(transform: (T) -> R?): R? {