Safe Haskell | None |
---|---|
Language | Haskell2010 |
Text utilities
Documentation
textShow :: (Show a, Typeable a) => a -> Text Source #
Stringifies specified value
If input is Text
, String
or ByteString
, it is returned as a
Text
string without additional quotes around it
Arguments:
val :: a
: Value to stringify
Return value: Text
string representation of a specified value
textSplit :: Text -> Text -> Vector Text Source #
Splits specified Text
string into a Vector
of parts using specified delimiter
Delimiter must be non-empty
Arguments:
haystack :: Text
: string to splitneedle :: Text
delimiter
Return value: Vector Text
vector containing the parts of the input string
textFormatParts :: Vector Text -> Vector Text -> Text Source #
Concatenates specified Vector
of string parts interspersing it with specified parameters
Length of the parameters Vector
must be equal to the length of the parts Vector
minus 1
Arguments:
parts :: Vector Text
: string partsparams :: Vector Text
parameters to intersperse into the parts
Return value: Vector Text
vector containing the parts of the input string
textFormat :: Text -> Vector Text -> Text Source #
Formats specified template with specified parameters Vector
Template must use {}
string for placeholders.
Number of specified parameters must equal to the number of placeholders inside the template.
Template preparation is relatively expensive, consider using textFormatParts
for
frequently used templates.
Arguments:
template :: Text
: string partsparams :: Vector Text
parameters to intersperse into the parts
Return value: Vector Text
vector containing the parts of the input string