words -package:text-zipper -package:cabal-install-solver -package:hledger -package:ghc package:xmonad-contrib
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"]
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"
Join words with spaces, and wrap the result in delimiters unless there
was exactly one element.
Examples
>>> wrapUnwords "{" "}" ["A", "B"]
"{A B}"
>>> wrapUnwords "{" "}" ["A"]
"A"
>>> wrapUnwords "{" "}" []
""
Add a string to the right, prepending a space to it if necessary
Remove a number of words from the left
Remove a number of words from the right
Keep a number of words from the left
Keep a number of words from the right
Add a string to the left, appending a space to it if necessary