[R-gregmisc-users] SF.net SVN: r-gregmisc:[1757] trunk/gdata/R/trim.R
Brought to you by:
warnes
From: <wa...@us...> - 2013-12-16 19:59:00
|
Revision: 1757 http://sourceforge.net/p/r-gregmisc/code/1757 Author: warnes Date: 2013-12-16 19:58:56 +0000 (Mon, 16 Dec 2013) Log Message: ----------- Trim will now remove all types of leading/trailing whitespace by using the [:blank:] character class. Modified Paths: -------------- trunk/gdata/R/trim.R Modified: trunk/gdata/R/trim.R =================================================================== --- trunk/gdata/R/trim.R 2013-12-07 16:12:05 UTC (rev 1756) +++ trunk/gdata/R/trim.R 2013-12-16 19:58:56 UTC (rev 1757) @@ -8,8 +8,8 @@ trim.character <- function(s, recode.factor=TRUE, ...) { - s <- sub(pattern="^ +", replacement="", x=s) - s <- sub(pattern=" +$", replacement="", x=s) + s <- sub(pattern="^[[:blank:]]+", replacement="", x=s) + s <- sub(pattern="[[:blank:]]+$", replacement="", x=s) s } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |