R/proper.R

Defines functions proper

Documented in proper

#' Convert a string to proper format.
#'
#' @param x A string.
#'
#' @return The proper version of \code{x}.
#' @export
#'
#' @examples
#' proper("hello world")
proper <- function(x){
  str <- unlist(strsplit(x, ''))
  ind <- c(0, grep(" ", str)) + 1
  str[ind] <- toupper(str[ind])
  return(paste0(str, collapse = ''))
}
faouser1/FAO documentation built on Nov. 4, 2019, 12:35 p.m.