R/trim_whitespace.R

Defines functions trim_whitespace

Documented in trim_whitespace

#' Remove trailing white spaces from a string
#'
#' \code{trim_whitespace} removes trailing white spaces from a character
#' string (or each string in a vector of character strings).
#' Non-trailing white spaces will be preserved.
#'
#' @param string A character string or vector of character strings
#' @return A character string or vector of character strings.
#'
#' @export
trim_whitespace <- function(string) {
  gsub(" +$", "", string)
}
rstudio/reportsWS documentation built on May 28, 2019, 5:42 a.m.