Learn R Programming

ubiquity (version 2.1.0)

pad_string: Pad String with Spaces

Description

Adds spaces to the beginning or end of strings until it reaches the maxlength. Used for aligning text.

Usage

pad_string(str, maxlength = 1, location = "beginning")

Value

Padded string

Arguments

str

string

maxlength

length to pad to

location

either "beginning" to pad the left or "end" to pad the right

Examples

Run this code
pad_string("bob", maxlength=10)
pad_string("bob", maxlength=10, location="end")

Run the code above in your browser using DataLab