W3cubDocs

/Kotlin

singleOrNull

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
fun CharSequence.singleOrNull(): Char?

Returns single character, or null if the char sequence is empty or has more than one character.

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
inline fun CharSequence.singleOrNull(
    predicate: (Char) -> Boolean
): Char?

Returns the single character matching the given predicate, or null if character was not found or more than one character was found.

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