isValidTemplateURILiteral

Checks if the given literal parameter is valid according to RFC 6570 section 2.1.

@safe
bool
isValidTemplateURILiteral
(
string literal
,
out size_t errorIndex
)

Return Value

Type: bool

false if invalid with errorIndex set to the first character breaking the validity. Potentially end-of-string index for unterminated percent-encoded characters.

Examples

size_t error;

assert(isValidTemplateURILiteral("hello", error));

assert(!isValidTemplateURILiteral("hello world", error));
assert(error == 5);

Meta