#' converts strings to camelCase
#'
#' converts strings to camelCase
#' @param x a string
#' @keywords camelCase
#' @export
#' @examples
#' camelCase("begin with")
camelCase <- function(x) {
dplyr::case_when(
!is.character(x) ~ as.character(x),
is.na(x) ~ NA_character_,
!stringr::str_detect(x, "[:punct:]| ") ~ keda::first_to_lower(x),
TRUE ~
stringr::str_replace_all(x, "[:punct:]", " ") %>%
stringr::str_to_title(.) %>%
stringr::str_remove_all(., " ") %>%
keda::first_to_lower()
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.