R/string.R

Defines functions proper

Documented in proper

#' 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 April 30, 2021, 1:06 a.m.