words -package:ghc-lib-parser -package:streams package:rio
words breaks a string up into a list of words, which were
delimited by white space (as defined by
isSpace). This function
trims any white spaces at the beginning and at the end.
Examples
>>> words "Lorem ipsum\ndolor"
["Lorem","ipsum","dolor"]
>>> words " foo bar "
["foo","bar"]
O(n) Breaks a
Text up into a list of words, delimited by
Chars representing white space.
unwords joins words with separating spaces (U+0020 SPACE).
unwords is neither left nor right inverse of
words:
>>> words (unwords [" "])
[]
>>> unwords (words "foo\nbar")
"foo bar"
Examples
>>> unwords ["Lorem", "ipsum", "dolor"]
"Lorem ipsum dolor"
>>> unwords ["foo", "bar", "", "baz"]
"foo bar baz"
O(n) Joins words using single space characters.