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))
}
averissimo/loose.rock documentation built on Dec. 8, 2022, 11:53 p.m.