View source code
Display the source code in std/uni.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Function std.uni.MatcherConcept.skip

Perform a semantic equivalent 2 operations: decoding a code point at front of inp and testing if it belongs to the set of code points of this matcher.

bool skip(Range) (
  ref Range inp
)
if (isRandomAccessRange!Range && is(ElementType!Range : char));

The effect on inp depends on the kind of function called:

Match. If the codepoint is found in the set then range inp is advanced by its size in code units, otherwise the range is not modifed.

Skip. The range is always advanced by the size of the tested code point regardless of the result of test.

Test. The range is left unaffected regardless of the result of test.

Example

string truth = "2² = 4";
auto m = utfMatcher!char(unicode.Number);
assert(m.match(truth)); // '2' is a number all right
assert(truth == "² = 4"); // skips on match
assert(m.match(truth)); // so is the superscript '2'
assert(!m.match(truth)); // space is not a number
assert(truth == " = 4"); // unaffected on no match
assert(!m.skip(truth)); // same test ...
assert(truth == "= 4"); // but skips a codepoint regardless
assert(!m.test(truth)); // '=' is not a number
assert(truth == "= 4"); // test never affects argument

Authors

Dmitry Olshansky

License

Boost License 1.0.