vt-utils-1.2.0.0: Vector and Text utilities

Safe HaskellNone
LanguageHaskell2010

VtUtils.Text

Description

Text utilities

Synopsis

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 split
  • needle :: 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 parts
  • params :: 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 parts
  • params :: Vector Text parameters to intersperse into the parts

Return value: Vector Text vector containing the parts of the input string