locbalq {lazy.tools}R Documentation

Find the Location of the Quote to the Right or Left of the One at loc.

Description

Find the Location of the Quote to the Right or Left of the One at loc.

Usage

locbalq(exp, loc, right = 1)

Arguments

exp

A string.

loc

The location of a quote.

right

= 0 to find the one to the left.

Details

If exp contains double quotes, exp must be defined by using single quotes or must be escaped by the use of \.

Value

The location of the quote found.

Examples

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))


[Package lazy.tools version 0.1.3 Index]