kotlin.text.partition

partition

inline fun CharSequence.partition(
    predicate: (Char) -> Boolean
): Pair<CharSequence, CharSequence>

Splits the original char sequence into pair of char sequences, where first char sequence contains characters for which predicate yielded true, while second char sequence contains characters for which predicate yielded false.