Learn R Programming

cwhmisc (version 6.0)

padding: Padding a string with justification

Description

padding Pads a string.

Usage

padding(str, space, with, to=c("left","right","center"))

Arguments

str
String to be padded.
space
Resulting length of padded string.
with
String to pad with. Will be repeated as often as necessary.
to
Mode of padding, one of "left","right","center".

Value

A string

Examples

Run this code
padding("My string",25,"XoX","center")
 # [1] "XoXXoXXoMy stringXXoXXoXX"

Run the code above in your browser using DataLab