HomeManualTopicsTypesSymbols

std_types::set/std::match

matches the start of a string with the set's characters

Parameters

self
a set of characters
str
the string which's start is matched

Result

len
1 if any character in the set matches the start of the string

Description

If the match is unsuccessful, then len is std::undefined.

Use the std::alt-function to construct a set of characters.

Example

$str "[abc]" $len match(alt('(' '[' '{') str) dump! `len

Output

len: 1

Example

$str "abc" $len match(alt('(' ']' '}') str) dump! `len

Output

len: <undefined>

Topic

Strings

Implements

std::match match the grammar object with the start of the specified string

See also

std::alt
std::match_back match the grammar object with the end of the specified string
std::search search from the grammar object from the start or end of the specified string