R/paste.R

Defines functions wrap

Documented in wrap

#' Surround Text With Text
#'
#' Wrapper for a common
#'
#' @param text Character vector
#' @param with Character, string to wrap around each component of `text`
#' @param ... Additional arguments passed to [paste0()]
#'
#' @return Character vector
#'
#' @examples
#' wrap(c("text1", "text2"), "'")
#' wrap(c("text1", "text2"), "'", collapse = ", ")
#' wrap(c("text1", "text2"), collapse = ", ")
#'
#' @export
wrap <- function(text, with = "", ...) {
  paste0(
    with,
    text,
    with,
    ...
  )
}
EricLamphere/ezextras documentation built on Sept. 14, 2022, 3:09 p.m.