1#' Center a string. 2#' 3#' Return \code{str} centered in a string of length \code{width}. 4#' 5#' @details Padding is done using the specified \code{fillchar} (default is an ASCII space). 6#' The original string is returned if \code{width} is less than or equal to \code{nchar(str)}. 7#' 8#' @param str A character vector. 9#' @param width An integer. 10#' @param fillchar A character string. 11#' 12#' @return A character vector. 13#' 14#' @references \url{https://docs.python.org/3/library/stdtypes.html#str.center} 15#' 16#' @seealso \code{\link{pystr_ljust}}, \code{\link{pystr_rjust}} 17#' 18#' @examples 19#' pystr_center("center me", 15) 20#' pystr_center("center me", 15, "*") 21#' 22#' @export 23pystr_center <- function(str, width, fillchar=" ") { 24 return(pystr_center_(str, width, fillchar)) 25} 26