R/first_to_upper.R

Defines functions first_to_upper

Documented in first_to_upper

#' makes just the first letter of string uppercase
#'
#' makes just the first letter of string uppercase and converts numbers to strings
#' @param x a string
#' @keywords strings first_to_uppercase
#' @export
#' @examples
#' first_to_upper("hiThere")

first_to_upper <- function(x){
  x_start <- stringr::str_sub(x, 1, 1) %>% stringr::str_to_upper()
  x_end <- stringr::str_sub(x, 2, -1)
  x <- paste0(x_start, x_end)
  return(x)
}
Kidapt/keda documentation built on Nov. 23, 2019, 3:35 a.m.