pad.string {fame}R Documentation

Pad strings to a particular length

Description

Pads a collection of strings to a desired length to either the left or right with a specified character.

Usage

pad.string(x, len = max(nchar(x)), padchar = " ", right = T)

Arguments

x character object
len desired length of the returned strings
padchar a single-character string.
right if TRUE (the default), the strings in x are padded to the right, else they are padded to the left.

Value

an object like x, but with the strings padded out to the desired length. Strings in x that are already len or more characters long are unaffected by the function.

Author(s)

Jeff Hallman

See Also

format

Examples

pad.string(c("aaa", "bbbbbb", "ccccccccccc"), len = 7, padchar = "X")

[Package fame version 1.05 Index]