Learn R Programming

tmcn (version 0.2-13)

strpad: Pad a string to a specified length with a padding character.

Description

Pad a string to a specified length with a padding character.

Usage

strpad(string, width = 0, side = c("left", "right", "both"),
  pad = " ")

Arguments

string

A character vector.

width

The number of characters of the string after padding.

side

Which side to pad.

pad

The padding character.

Value

A character vector after padding.

Examples

Run this code
# NOT RUN {
strpad(1:5, width = 4, pad = "0")


# }

Run the code above in your browser using DataLab