dev
Download
39 lines 1017 BGroffModified 2025-11-29 raw
123456789101112131415161718192021222324252627282930313233343536373839
'\" t
.\" Copyright (c) 2025 Bruce Hill
.\" All rights reserved.
.\"
.TH Text.middle_pad 3 2025-11-29 "Tomo man-pages"
.SH NAME
Text.middle_pad \- pad text, centered
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI Text.middle_pad\ :\ func(text:\ Text,\ width:\ Int,\ pad:\ Text\ =\ "\ ",\ language:\ Text\ =\ "C"\ ->\ Text)
.fi
.SH DESCRIPTION
Pad some text on the left and right side so it reaches a target width.


.SH ARGUMENTS

.TS
allbox;
lb lb lbx lb
l l l l.
Name	Type	Description	Default
text	Text	The text to pad. 	-
width	Int	The target width. 	-
pad	Text	The padding text. 	"\ "
language	Text	The ISO 639 language code for which character width to use. 	"C"
.TE
.SH RETURN
Text with length at least `width`, with extra padding on the left and right as needed. If `pad` has length greater than 1, it may be partially repeated to reach the exact desired length.

.SH EXAMPLES
.EX
assert "x".middle_pad(6) == "  x   "
assert "x".middle_pad(10, "ABC") == "ABCAxABCAB"
.EE
.SH SEE ALSO
.BR Tomo-Text (3)