strs_ljust
left-justifies each element of a character vector in a field of
a specified width. It is similar to Python's str.ljust()
method.
Usage
strs_ljust(string, width, fillchar = " ")
Arguments
- string
A character vector where each element is a string to be
left-justified.
- width
The total width of the field in which the string is to be
left-justified.
- fillchar
A character used for padding on the right.
Value
A character vector of the same length as string
, with each element
left-justified in a field of the specified width.
Examples
strs_ljust("hello", 10)
#> [1] " hello"
strs_ljust("world", 10, "*")
#> [1] "*****world"