R/toupper_all.R

Defines functions toupper_all

Documented in toupper_all

#' Function for Capitalize First Letters
#' 
#' @description Function for Capitalize First Letters of all Words in a string.
#' Taken from \code{?toupper()}.
#' 
#' @param x A string.
#'
#' @export
#'
#' @examples 
#' s = c('hello darkness my old Friend')
#' toupper_all(s)
#'
toupper_all = function(x) {
  s = strsplit(x, " ")[[1]]
  paste(toupper(substring(s, 1,1)), substring(s, 2),
        sep="", collapse=" ")
}
andschar/andmisc documentation built on Jan. 19, 2025, 10:46 a.m.