StrPad {DescTools} | R Documentation |
Pad a String With Justification
Description
StrPad
will fill a string x with defined characters to fit a given length.
Usage
StrPad(x, width = NULL, pad = " ", adj = "left")
Arguments
x |
a vector of strings to be padded. |
width |
resulting width of padded string. If x is a vector and width is left to NULL, it will be set to the length of the largest string in x. |
pad |
string to pad with. Will be repeated as often as necessary. Default is " ". |
adj |
adjustement of the old string, one of |
Details
If a string x has more characters than width, it will be chopped on the length of width.
Value
the string
Author(s)
Christian W. Hoffmann <c-w.hoffmann@sunrise.ch>
some extensions Andri Signorell <andri@signorell.net>
Examples
StrPad("My string", 25, "XoX", "center")
# [1] "XoXXoXXoMy stringXXoXXoXX"
[Package DescTools version 0.99.55 Index]