peekWhile

fun peekWhile(predicate: (Char) -> Boolean): String?

Collect characters from the cursor while the predicate returns true, and return those characters joined into a String. If the predicate fails on the first character, null will be returned instead. After characters have been collected, the cursor's index is reset, so the characters won't be consumed.