matchBracket

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

@safe pure nothrow
sizediff_t
matchBracket
(
const(char)[] str
,
bool nested = true
)

Parameters

str const(char)[]

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