matchBracket

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

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

Parameters

str string

input string

nested 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