########################
## 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.