stripComments: Strip comments from elements of a character vector

View source: R/TextFunctions.R

stripCommentsR Documentation

Strip comments from elements of a character vector

Description

Function to strip comments from elements of a character vector.

Usage

stripComments(strv, comment = "#")

Arguments

strv
  • character vector to strip comments from

comment
  • character indicating remaining text is a comment

Details

The returned character vector will not have the same number of elements as the original if the latter had elements that were only comments or 'blank' elements. Thus, one use of this function could be to remove blank lines, comment-only lines, and commented text from a character vector created by reading a text file using readLines().

Value

character vector with comments removed.


wStockhausen/wtsUtilities documentation built on Feb. 3, 2025, 6:29 a.m.