Module text
Library for manipulating text and formatting objects
Functions
padLeft (text, len[, char=" "]) | Pad text to the left so it has a minimum size of the given length. |
padRight (text, len[, char=" "]) | Pad text to the right so it has a minimum size of the given length. |
padCenter (text, len[, char=" "]) | Pad text to the center so it has a minimum size of the given length. |
formatTable (t, order) | Format the given table into a spreadsheet-like format |
Functions
- padLeft (text, len[, char=" "])
-
Pad text to the left so it has a minimum size of the given length.
Parameters:
- text string The text to pad
- len int The target length of the text
- char string The character used to pad the text (default " ")
Returns:
-
string
The padded text
- padRight (text, len[, char=" "])
-
Pad text to the right so it has a minimum size of the given length.
Parameters:
- text string The text to pad
- len int The target length of the text
- char string The character used to pad the text (default " ")
Returns:
-
string
The padded text
- padCenter (text, len[, char=" "])
-
Pad text to the center so it has a minimum size of the given length.
The centering is right-leaning. That is if dividing the target in half gives
a fractional result, the number of padding on the left is the ceil of that number.
Parameters:
- text string The text to pad
- len int The target length of the text
- char string The character used to pad the text (default " ")
Returns:
-
string
The padded text
- formatTable (t, order)
-
Format the given table into a spreadsheet-like format
Parameters:
- t tab The table to be formatted
- order tab The order in which the labels must be printed
Returns:
-
string
The formatted table