#' str_split_one
#'
#' @param string A character vector with one element.
#' @param pattern What to split on.
#' @param n i dont know what is it
#'
#' @return A character vector.
#' @export
#'
#' @examples
#' x <- "alfa,bravo,charlie,delta"
#' str_split_one(x, pattern = ",")
str_split_one <- function(string, pattern, n = Inf) {
stopifnot(is.character(string), length(string) <= 1)
if (length(string) == 1) {
stringr::str_split(string = string, pattern = pattern, n = n)[[1]]
} else {
character()
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.