R/trimws.R

trimws <- function(x,left=TRUE,right=TRUE){
  res <- x
  old.locale <- Sys.getlocale("LC_CTYPE")
  Sys.setlocale("LC_CTYPE","C")
  if(left)
    res <- sub('^\\s+', '',res)
  if(right)
    res <- sub('\\s+$', '',res)
  Sys.setlocale("LC_CTYPE",old.locale)
  res
}

Try the mutils package in your browser

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

mutils documentation built on May 2, 2019, 4:44 p.m.