wordsBy -package:streamly

Split into "words", with word boundaries indicated by the given predicate. Satisfies words === wordsBy isSpace; equivalent to split . dropBlanks . dropDelims . whenElt.
>>> wordsBy (`elem` ",;.?! ") "Hello there, world! How?"
["Hello","there","world","How"]
>>> wordsBy (=='x') "dogxxxcatxbirdxx"
["dog","cat","bird"]
A variant of words with a custom test. In particular, adjacent separators are discarded, as are leading or trailing separators.
wordsBy (== ':') "::xyz:abc::123::" == ["xyz","abc","123"]
\s -> wordsBy isSpace s == words s
Chop a list into segments, at separators identified by the predicate. The separator items are discarded.
Split the stream after stripping leading, trailing, and repeated separators as per the fold supplied. Therefore, ".a..b." with . as the separator would be parsed as ["a","b"]. In other words, its like parsing words from whitespace separated text.
Split a list into sublists. Generalisation of the prelude function words. Same as wordsBy and wordsBy, but with the non-emptyness guarantee on the chunks. O(n).
words xs == wordsBy isSpace xs
split given list of a by given single a, e.g.
>>> wordsBy (== ':') "bd:3"
["bd", "3"]
Split into "words", with word boundaries indicated by the given predicate. Satisfies words === wordsBy isSpace; equivalent to split . dropBlanks . dropDelims . whenElt. For example:
>>> wordsBy (=='x') (BV.fromList "dogxxxcatxbirdxx")
["dog","cat","bird"]