Learn R Programming

RavenR (version 2.2.0)

rvn_stringpad: Pads string with spaces, either right or left justified

Description

Pad string with spaces, justified on either the left or right

Usage

rvn_stringpad(string, width, just = "r", padstring = " ")

Value

Padded string

Arguments

string

Text string

width

Number of characters total, including desired spaces

just

'r' for right, 'l' for left

padstring

string to use for padding (default space character)

Author

Leland Scantlebury, leland@scantle.com

Examples

Run this code
# Returns "   To the right"
rvn_stringpad('To the right', 15, just='r')

# Returns "Padded    "
rvn_stringpad('Padded', 10, just='l')

Run the code above in your browser using DataLab