John Fox <jfox <at> mcmaster.ca> writes: : This is something that I sometimes want to do, so I have a little utility : that trims blanks and tabs from the beginnings and ends of strings: : : trim.ws <- function(text) gsub("^[\ \t]", "", gsub("[\ \t]*$", "", text)) :
This can be reduced to a single gsub like this: gsub("^[[:space:]]+|[[:space:]]+$", "", text) ______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html