R/stripWhiteSpace.R

########################
## Benjamin Haibe-Kains
## All rights Reserved
## September 1, 2013
########################


`stripWhiteSpace` <-
function (str, method=c("both", "head", "tail")) {
  method <- match.arg(method)
  str2 <- NULL
  if (length(str) == 1) {
    switch (method,
      "both" = {
       str2 <- gsub("^[ \t]+", "", str)
       str2 <- gsub("[ \t]+$", "", str2)
      },
      "head" = {
        str2 <- gsub("^[ \t]+", "", str)
      },
      "tail" = {
        str2 <- gsub("[ \t]+$", "", tt)
      }
    )
    return (str2)
  } else {
    str2 <- sapply(str, stripWhiteSpace, method=method)
    return (str2)
  }
}

## End
bhklab/MetaGx documentation built on May 12, 2019, 8:25 p.m.