Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- count :: Text -> Text -> Int
- decodeLatin1 :: ByteString -> Text
- decodeUtf16BE :: ByteString -> Text
- decodeUtf16LE :: ByteString -> Text
- decodeUtf32BE :: ByteString -> Text
- decodeUtf32LE :: ByteString -> Text
- decodeUtf8 :: ByteString -> Text
- foldl1' :: (Char -> Char -> Char) -> Text -> Char
- foldr1 :: (Char -> Char -> Char) -> Text -> Char
- head :: Text -> Char
- index :: Text -> Int -> Char
- init :: Text -> Text
- last :: Text -> Char
- maximum :: Text -> Char
- minimum :: Text -> Char
- splitOn :: Text -> Text -> [Text]
- tail :: Text -> Text
Documentation
decodeLatin1 :: ByteString -> Text #
Decode a ByteString
containing Latin-1 (aka ISO-8859-1) encoded text.
decodeLatin1
is semantically equivalent to
Data.Text.pack . Data.ByteString.Char8.unpack
decodeUtf16BE :: ByteString -> Text #
Decode text from big endian UTF-16 encoding.
If the input contains any invalid big endian UTF-16 data, an
exception will be thrown. For more control over the handling of
invalid data, use decodeUtf16BEWith
.
decodeUtf16LE :: ByteString -> Text #
Decode text from little endian UTF-16 encoding.
If the input contains any invalid little endian UTF-16 data, an
exception will be thrown. For more control over the handling of
invalid data, use decodeUtf16LEWith
.
decodeUtf32BE :: ByteString -> Text #
Decode text from big endian UTF-32 encoding.
If the input contains any invalid big endian UTF-32 data, an
exception will be thrown. For more control over the handling of
invalid data, use decodeUtf32BEWith
.
decodeUtf32LE :: ByteString -> Text #
Decode text from little endian UTF-32 encoding.
If the input contains any invalid little endian UTF-32 data, an
exception will be thrown. For more control over the handling of
invalid data, use decodeUtf32LEWith
.
decodeUtf8 :: ByteString -> Text #
Decode a ByteString
containing UTF-8 encoded text that is known
to be valid.
If the input contains any invalid UTF-8 data, an exception will be
thrown that cannot be caught in pure code. For more control over
the handling of invalid data, use decodeUtf8'
or
decodeUtf8With
.
foldl1' :: (Char -> Char -> Char) -> Text -> Char #
O(n) A strict version of foldl1
. Subject to fusion.
O(1) Returns the first character of a Text
, which must be
non-empty. Subject to fusion.
O(1) Returns all but the last character of a Text
, which must
be non-empty. Subject to fusion.
O(1) Returns the last character of a Text
, which must be
non-empty. Subject to fusion.
O(m+n) Break a Text
into pieces separated by the first Text
argument (which cannot be empty), consuming the delimiter. An empty
delimiter is invalid, and will cause an error to be raised.
Examples:
>>>
splitOn "\r\n" "a\r\nb\r\nd\r\ne"
["a","b","d","e"]
>>>
splitOn "aaa" "aaaXaaaXaaaXaaa"
["","X","X","X",""]
>>>
splitOn "x" "x"
["",""]
and
intercalate s . splitOn s == id splitOn (singleton c) == split (==c)
(Note: the string s
to split on above cannot be empty.)
In (unlikely) bad cases, this function's time complexity degrades towards O(n*m).