View source code
Display the source code in std/utf.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.
Checks if a single character forms a valid code point.
bool isValidCodepoint(Char) (
When standing alone, some characters are invalid code points. For
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, D90, D91 and D92 for more details.
|c||character to test|
|Char|| character type of |
c forms a valid code point.
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));
Copyright © 1999-2023 by the D Language Foundation | Page generated by ddox.