countWords

inline fun CharSequence.countWords(wordSeparator: (Char) -> Boolean = { it == ' ' }): Int(source)

Returns the number of words in the string without creating intermediate objects.

Parameters

wordSeparator

a function that returns true if the character is a word separator