single (original) (raw)

fun CharSequence.single(): Char(source)

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

Since Kotlin

1.0


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

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

Since Kotlin

1.0