words -package:text-zipper -package:rebase -package:hedgehog -package:streaming-bytestring -package:bytestring
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.
Split an input into word-sized
Docs.
>>> putDoc (tupled (words "Lorem ipsum dolor"))
(Lorem, ipsum, dolor)
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.
>>> words "Lorem ipsum\ndolor"
["Lorem","ipsum","dolor"]
>>> words " foo bar "
["foo","bar"]
Splits a bytestring
InputStream into words. See
splitOn
and
words.
Example:
ghci> is <- Streams.fromList ["Hello, world!"] >>= Streams.words
ghci> replicateM 3 (Streams.read is)
[Just "Hello,", Just "world!", Nothing]
Note that this may increase the chunk size if the input contains
extremely long words.
words takes
Text and splits it into the list by words.
Actual type of this function is the following:
words :: Text -> [Text]
but it was given a more complex type to provide friendlier compile
time errors.
>>> words ""
[]
>>> words "one line"
["one","line"]
>>> words " >_< "
[">_<"]
>>> words ("string words" :: String)
...
... 'words' works with 'Text', not 'String'.
Possible fixes:
1. Make sure OverloadedStrings extension is enabled.
2. Apply 'toText' to a single value.
3. Apply 'map toText' to the list value.
...
>>> words True
...
... 'words' works with 'Text'
But given: 'Bool'
...
words breaks a string up into a list of words, which were
delimited by white space.
>>> words "Lorem ipsum\ndolor"
["Lorem","ipsum","dolor"]
Break up a textual sequence into a list of words, which were delimited
by white space.
> words "abc def ghi"
["abc","def","ghi"]
Convert a bytestream to delimited words
Note: This function is purely for demonstration purposes since it
assumes a particular encoding. You should prefer the
Text
equivalent of this function from the
pipes-text library.
Breaks a string into a list of words
O(n) Breaks a
JSString up into a list of words,
delimited by
Chars representing white space.
Splits the given
YiString into a list of words, where spaces
are determined by
isSpace. No empty strings are in the result
list.
The
words function breaks a stream of characters into a stream
of words, which were delimited by white space.
Beware: if the stream of characters
xs does not
contain white space, accessing the tail of
words xs will
loop.
Break a string up into a stream of strings, which were delimited by
characters representing white space.
words = S.words A.write
>>> Stream.fold Fold.toList $ Unicode.words $ Stream.fromList "A newline\nis considered white space?"
[fromList "A",fromList "newline",fromList "is",fromList "considered",fromList "white",fromList "space?"]
Fold each word of the stream using the supplied
Fold and stream
the result.
>>> Stream.fold Fold.toList $ Unicode.words Fold.toList (Stream.fromList "fold these words")
["fold","these","words"]
words = Stream.wordsBy isSpace
Pre-release
Split words in a string using spaces as separation
words "Hello Foundation"
Split an infinite string into words, by any
isSpace symbol.
Leading spaces are removed and, as underlined by the return type,
repeated spaces are treated as a single delimiter.
Split a string into
words.
List of all words in this paragraph.
List of all words in this paragraph.
List of all words in this paragraph.
List of all words in this paragraph.