| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Data.Text.AlignEqual
Description
A module providing functions for text alignment and padding.
Synopsis
- prefixLength :: Text -> Maybe Int
- adjustLine :: Int -> Text -> Text
- adjustText :: Text -> Text
Documentation
Adjusts the prefix of a text line to a desired length by adding padding spaces.
>>>adjustLine 5 "key=value""key =value">>>adjustLine 3 "a=b""a =b"
Arguments
| :: Text | The input text (possibly multi-line) |
| -> Text | The aligned text, or the original text if no '=' is found |
Processes multi-line text to align all '=' signs across lines. It adjusts the prefix length of each line to match the maximum prefix length. If a line does not contain '=', it will be left as-is. If the input is empty or contains no lines with '=', it is returned unchanged.
>>>adjustText "key=value\na=b""key=value\na =b">>>adjustText "x=y\nlong=var""x =y\nlong=var">>>adjustText """"