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

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

See Also

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

Meta

Suggestion Box / Bug Report