words -package:text-zipper -is:module -package:faktory -package:streaming-bytestring -package:foundation
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"]
words breaks a ByteString up into a list of words, which were
delimited by Chars representing white space.
words breaks a ByteString up into a list of words, which were
delimited by Chars representing white space. And
tokens isSpace = words
O(n) Breaks a
Text up into a list of words, delimited by
Chars representing white space.
hedgehog Hedgehog.Internal.Prelude,
base-compat Data.String.Compat Prelude.Compat,
rio RIO.List RIO.Prelude,
base-prelude BasePrelude,
numeric-prelude NumericPrelude NumericPrelude.Base,
Cabal-syntax Distribution.Compat.Prelude,
github GitHub.Internal.Prelude,
numhask NumHask.Prelude,
ghc-lib-parser GHC.Prelude.Basic,
dimensional Numeric.Units.Dimensional.Prelude,
rebase Rebase.Prelude,
hledger Hledger.Cli.Script,
mixed-types-num Numeric.MixedTypes.PreludeHiding,
xmonad-contrib XMonad.Config.Prime,
stack Stack.Prelude,
LambdaHack Game.LambdaHack.Core.Prelude Game.LambdaHack.Core.Prelude,
cabal-install-solver Distribution.Solver.Compat.Prelude,
yesod-paginator Yesod.Paginator.Prelude,
distribution-opensuse OpenSuse.Prelude,
hledger-web Hledger.Web.Import words breaks a string up into a list of words, which were
delimited by white space.
>>> words "Lorem ipsum\ndolor"
["Lorem","ipsum","dolor"]
Split an input into word-sized
Docs.
>>> putDoc (tupled (words "Lorem ipsum dolor"))
(Lorem, ipsum, dolor)
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'
...
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
Splits the given
YiString into a list of words, where spaces
are determined by
isSpace. No empty strings are in the result
list.
Split a text stream into
FreeT-delimited words. Note that
roundtripping with e.g.
over words id eliminates extra space
characters as with
Prelude.unwords . Prelude.words
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.
Split words in a string using spaces as separation
words "Hello Foundation"
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 $ words Fold.toList (Stream.fromList "fold these words")
["fold","these","words"]
words = Stream.wordsBy isSpace
Pre-release
Split a string into
words.
Split an infinite string into words, by any
isSpace symbol.
Not on Stackage, so not searched.
Cross-platform access to a list of words
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') "dogxxxcatxbirdxx" == ["dog","cat","bird"]
Convert the given number of words to a number of bytes.
This function morally has type WordOff -> ByteOff, but
uses Num a to allow for overloading.