splitByPattern
From R.utils v2.9.2
by Henrik Bengtsson
Splits a single character string by pattern
Splits a single character string by pattern. The main difference compared to strsplit
()
is that this method also returns the part of the string that matched
the pattern. Also, it only takes a single character string.
- Keywords
- programming
Usage
# S3 method for default
splitByPattern(str, pattern, ...)
Arguments
Value
Returns a named character
vector
with names equal to "TRUE"
if element is a pattern part and "FALSE"
otherwise.
See Also
Compare to strsplit
().
Examples
# NOT RUN {
rspCode <- "<body>Hello <%=\"world\"%></body>"
rspParts <- splitByPattern(rspCode, pattern="<%.*%>")
cat(rspCode, "\n")
print(rspParts)
# }
Community examples
Looks like there are no examples yet.