W3cubDocs

/Kotlin

single

fun CharSequence.single(): Char

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

inline fun CharSequence.single(
    predicate: (Char) -> Boolean
): Char

Returns the single character matching the given predicate, or throws exception if there is no or more than one matching character.

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