pad: Simple pad function

Description Usage Arguments Author(s) Examples

Description

Places zeros to the left of a string. If the string consists only of digits 0-9, pad() does not change the value of the string if interpreted as a numeric.

Usage

1
pad(x,len,padchar="0",strict=TRUE)

Arguments

x

Input argument (converted to character)

len

Desired length of output

padchar

Character to pad x with, defaulting to “0”

strict

Boolean variable governing the behaviour when length of x is less than len. Under these circumstances, if strict takes the default value of TRUE, then return an error; if FALSE, return a truncated version of x (least significant characters retained)

Author(s)

Robin K. S. Hankin

Examples

1
2
pad("1234",len=10)
pad("1234",len=3,strict=FALSE)

emulator documentation built on April 25, 2021, 9:07 a.m.