matchBracket

Finds the closing bracket (works with any of '[', '(', '<', '{').

package
sizediff_t
matchBracket
@safe pure nothrow
(
string str
,
bool nested = true
)

Parameters

str
Type: string

input string

nested
Type: bool

whether to skip nested brackets

Return Value

Type: sizediff_t

The index of the closing bracket or -1 for unbalanced strings and strings that don't start with a bracket.

Meta