R/string.R

#' Capitalizes all words in string
#'
#' @param x String
#'
#' @return a capitalized string (all words)
#' @export
#'
#' @examples
#' proper('i saw a dEaD parrot')
proper <- function(x) {
  return(gsub("(?<=\\b)([a-z])", "\\U\\1", tolower(x), perl=TRUE))
}

Try the loose.rock package in your browser

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

loose.rock documentation built on May 31, 2019, 5:04 p.m.