unicode.opDispatch

Performs the lookup of set of $(CODEPOINTS) with compile-time correctness checking. This short-cut version combines 3 searches: across blocks, scripts, and common binary properties.

Note that since scripts and blocks overlap the usual trick to disambiguate is used - to get a block use unicode.InBlockName, to search a script use unicode.ScriptName.

struct unicode
static @property pure
opDispatch
(
string name
)
()

Examples

import std.exception : collectException;
auto ascii = unicode.ASCII;
assert(ascii['A']);
assert(ascii['~']);
assert(!ascii['\u00e0']);
// matching is case-insensitive
assert(ascii == unicode.ascII);
assert(!ascii['à']);
// underscores, '-' and whitespace in names are ignored too
auto latin = unicode.in_latin1_Supplement;
assert(latin['à']);
assert(!latin['$']);
// BTW Latin 1 Supplement is a block, hence "In" prefix
assert(latin == unicode("In Latin 1 Supplement"));
// run-time look up throws if no such set is found
assert(collectException(unicode("InCyrilliac")));

See Also

block, script and (not included in this search) hangulSyllableType.

Meta