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.unicode.parseSet

Parse unicode codepoint set from given range using standard regex syntax '[...]'. The range is advanced skiping over regex set definition. casefold parameter determines if the set should be casefolded - that is include both lower and upper case versions for any letters in the set.

CodepointSet parseSet(Range) (
  ref Range range,
  bool casefold = false
)
if (isInputRange!Range && is(ElementType!Range : dchar));

Example

import std.uni : unicode;
string pat = "[a-zA-Z0-9]hello";
auto set = unicode.parseSet(pat);
// check some of the codepoints
assert(set['a'] && set['A'] && set['9']);
writeln(pat); // "hello"

Authors

Dmitry Olshansky

License

Boost License 1.0.