R/stringFunctions.R

Defines functions stripBlanks blanks

Documented in blanks stripBlanks

blanks <- function(n) sprintf(paste("%", round(n), "s", sep = ""), "")

stripBlanks <- function(strings){
  ## strips leading and trailing blanks
  ans <- gsub("^ *(.*)", "\\1", strings)
  notEmpty <- nchar(ans) > 0
  ans[notEmpty] <- gsub(" *$", "", ans[notEmpty])
  ans
}

Try the tis package in your browser

Any scripts or data that you put into this service are public.

tis documentation built on Sept. 29, 2021, 1:06 a.m.