R/str_dup.R

Defines functions str_dup

Documented in str_dup

#' Duplicate and concatenate strings within a character vector
#'
#' Dependency-free drop-in alternative for `stringr::str_dup()`.
#'
#' @source Adapted from the [stringr](https://stringr.tidyverse.org/) package.
#'
#' @param string Input character vector.
#' @param times Number of times to duplicate each string.
#'
#' @return A character vector.
#' @export
#' @staticexport
str_dup <- function(string, times) {
	strrep(string, times)
}

Try the stringstatic package in your browser

Any scripts or data that you put into this service are public.

stringstatic documentation built on July 26, 2023, 5:32 p.m.