The OpenD Programming Language

isValidCodepoint

Checks if a single character forms a valid code point.

When standing alone, some characters are invalid code points. For example the wchar 0xD800 is a so called high surrogate, which can only be interpreted together with a low surrogate following it. As a standalone character it is considered invalid.

See Unicode Standard for more details.

bool
isValidCodepoint
(
Char
)
(
Char c
)
if ()

Parameters

c Char

character to test

Char

character type of c

Return Value

Type: bool

true, if c forms a valid code point.

Examples

assert( isValidCodepoint(cast(char) 0x40));
assert(!isValidCodepoint(cast(char) 0x80));
assert( isValidCodepoint(cast(wchar) 0x1234));
assert(!isValidCodepoint(cast(wchar) 0xD800));
assert( isValidCodepoint(cast(dchar) 0x0010FFFF));
assert(!isValidCodepoint(cast(dchar) 0x12345678));

Meta