locbalq {lazy.tools} | R Documentation |
Find the Location of the Quote to the Right or Left of the One at loc.
locbalq(exp, loc, right = 1)
exp |
A string. |
loc |
The location of a quote. |
right |
= 0 to find the one to the left. |
If exp contains double quotes, exp must be defined by using single quotes or must be escaped by the use of \.
The location of the quote found.
exp='regexp("a", "12""a56")'
loc=regexpr('"',exp)
locn=locbalq(exp, loc)
Print(substr(exp,loc,locn))
loc=13
locn=locbalq(exp, loc)
Print(substr(exp,loc,locn))
# location of the non-matching quote
loc=10
locn=locbalq(exp, loc)
Print(substr(exp,loc,locn))
exp="regexp('a', '12''a56')"
locbalq(exp, regexpr("'",exp))
loc=16
locn=locbalq(exp, loc, right=0)
Print(substr(exp,locn,loc))