R/deblank.R

Defines functions deblank

Documented in deblank

#' Remove Leading and Trailing Spaces
#'
#' @description Removes leading and trailing spaces from character strings.
#'
#' @param x Character string(s).
#'
#' @examples
#' x <- "  Why hello there. "
#' print(deblank(x))
#'
#' @export deblank
deblank <- function(x){
   x <- gsub("^[ \t\r\n]+", "", x, perl = TRUE)
   x <- gsub("[ \t\r\n]+$", "", x, perl = TRUE)
   return(x)
}
TobieSurette/gulf.utils documentation built on Dec. 1, 2024, 6:01 a.m.