RosettaCodeData/Task/Strip-comments-from-a-string/R/strip-comments-from-a-string-1.r
Ingy döt Net 68f8f3e56b all tasks
2013-04-11 01:07:29 -07:00

5 lines
156 B
R

strip_comments <- function(str)
{
if(!require(stringr)) stop("you need to install the stringr package")
str_trim(str_split_fixed(str, "#|;", 2)[, 1])
}