align_strings: Pad Strings to be the Same Length

View source: R/S03_Utilities.R

align_stringsR Documentation

Pad Strings to be the Same Length

Description

Function that pads strings to be the same length, with padding applied either to the left or right-hand side.

Usage

align_strings(strings, left = TRUE)

Arguments

strings

A character vector.

left

Logical; if TRUE left-aligns strings, otherwise right-aligns strings.

Value

A character vector.

Examples

# Strings of unequal length
x <- c( "A", "BB", "CCC" )

# Left-aligned
s <- align_strings( x )
message( paste0( '|', s, '|\n' ) )

# Right-aligned
s <- align_strings( x, FALSE )
message( paste0( '|', s, '|\n' ) )


rettopnivek/arfpam documentation built on Oct. 20, 2024, 7:24 p.m.