splitByPattern

0th

Percentile

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.

Usage
## S3 method for class 'default}(str, pattern, ...)':
splitByPatternundefined

 str{A single character string to be split.}
  pattern{A regular expression character string.}
  ...{Not used.}

 Returns a named character vector with names equal to "TRUE"
   if element is a pattern part and "FALSE" otherwise.

 rspCode <- "Hello <%="world"%>"
rspParts <- splitByPattern(rspCode, pattern="<%.*%>")
cat(rspCode, "
")
print(rspParts)

 [object Object]

 Compare to strsplit().


programming
Aliases
  • splitByPattern.default
  • splitByPattern
Documentation reproduced from package R.utils, version 0.7.9, License: LGPL version 2.1 or newer (the releases)

Community examples

Looks like there are no examples yet.