Skip to contents

Dependency-free drop-in alternative for stringr::str_pad().

Usage

str_pad(
  string,
  width,
  side = c("left", "right", "both"),
  pad = " ",
  use_width = TRUE
)

Source

Adapted from the stringr package.

Arguments

string

Input vector. Either a character vector, or something coercible to one.

width

Minimum width of padded strings.

side

Side on which padding character is added (left, right or both).

pad

Single padding character (default is a space).

use_width

If FALSE, use the length of the string instead of the width; see str_width()/str_length() for the difference.

Value

A character vector.

Author

Eli Pousson eli.pousson@gmail.com (ORCID)

Alexander Rossell Hayes alexander@rossellhayes.com (ORCID)