Documentation
¶
Index ¶
- func Center(s string, sz int) string
- func Columnize(columns ...string) string
- func Indent(s string, tag, prefix string) string
- func Justify(s string, sz int) string
- func LazyTab(s string, tag, prefix string, sz int) string
- func LazyWrap(s string, sz int) string
- func Left(s string, sz int) string
- func Right(s string, sz int) string
- func Rowwise(rows ...string) string
- func Tab(s string, tag, prefix string, sz int) string
- func Tabulate(tabbedtext string) string
- func Wrap(s string, sz int) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Center ¶ added in v0.6.0
Center centers text and pads it with spaces to reach the given "visual" length.
func Indent ¶
Indent inserts a name/bullet/number at the beginning of the string, then indents it (add prefix at the beginning and before any new line).
Tag is superposed to the indent prefix to obtain the first line prefix, if tag length is greater than prefix, prefix is completed by trailing spaces.
func Justify ¶
Justify wraps a text to the given maximum size and makes sure that returned lines are of exact provided size by wrapping and padding them as needed.
func LazyTab ¶ added in v0.6.2
LazyTab wraps and indents the given text.
LazyTab operates like Tab but relies on LazyWrap and does not split long words to fit the provided "visual" limit.
func LazyWrap ¶ added in v0.6.1
LazyWrap wraps a text by ensuring that each of its line's "visual" length is lower or equal to the provided limit. Wrap works with word limits being spaces.
If a "word" is encountered that is longer than the limit, it is not split in chunks of 'limit' length and is kept as is.
func Left ¶ added in v0.6.0
Left aligns text on the left and pads it with spaces to reach the given "visual" length.
func Right ¶ added in v0.6.0
Right aligns text on the right and pads it with spaces to reach the given "visual" length.
func Rowwise ¶ added in v0.6.0
Rowwise organizes supplied strings in a table-like fashion. Each string is displayed as a table row, each '\t' delimiting a column.
func Tab ¶
Tab wraps and indents the given text.
Tab will additionally add the given tag in front of the first line. Tag is superposed to the indent prefix to obtain the first line prefix, if tag's length is greater than prefix, prefix is completed by trailing spaces.
Tab calculates the correct wrapping limits taking indent's prefix length. It does not work if prefix is made of tabs as indent's tag/prefix length is unknown (like '\t').
Types ¶
This section is empty.