byteslice-0.2.13.2: Slicing managed and unmanaged memory
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Bytes.Text.Ascii

Description

This module treats Bytes data as holding ASCII text. Providing bytes outside the ASCII range (U+0000 -- U+007F) may cause a failure or unspecified results, but such bytes will never be inspected.

For functions that can operate on ASCII-compatible encodings, see AsciiExt.

Synopsis

Documentation

fromString :: String -> Bytes Source #

Convert a String consisting of only characters in the ASCII block to a byte sequence. Any character with a codepoint above U+007F is replaced by U+0000.

decodeDecWord :: Bytes -> Maybe Word Source #

Decode machine-sized word from decimal representation. Returns Nothing on overflow. Allows any number of leading zeros. Trailing non-digit bytes cause Nothing to be returned.

equalsCStringCaseInsensitive :: CString -> Bytes -> Bool Source #

Is the byte sequence equal to the NUL-terminated C String? The C string must be a constant.

toText :: Bytes -> Maybe Text Source #

Interpret byte sequence as ASCII codepoints. Only available when building with text-2.0 and newer. Returns Nothing if any of the bytes are outside of the range 0x00-0x7F