bracketedStrings {DAVIDQuery} | R Documentation |
Extract substrings that are bracketed by specified strings before and after.
bracketedStrings(s, before, after, verbose=FALSE, addNames=FALSE, drop.na=TRUE, warn.if.gt.1=TRUE)
s |
Vector of strings to search. |
before |
String to the left of the desired substring within s. |
after |
String to the right of the desired substring within s. |
verbose |
If TRUE, print the starting and ending index (or indices) of the desired substring(s). |
addNames |
If TRUE, and if s is a vector, set the names attribute of the return value to s . |
drop.na |
If TRUE, remove empty strings from the return value. |
warn.if.gt.1 |
If TRUE, warn if a string has more than one pair of bracketed target strings. |
For a single input string s
, the return value is the desired substring sandwiched between before
and after
. For a vector of inputs, list of outputs.
Roger Day
bracketedStrings("quickbrownfox", "quick", "fox") bracketedStrings(c("quickbrownfox", "quickredfox"), "quick", "fox", addNames=TRUE) bracketedStrings("quickbrownfoxANDquickredfox", "quick", "fox") bracketedStrings("quickbrownfoxANDquickredfox", "quick", "fox", warn.if.gt.1=FALSE)