chsvlib
chsv helper source code

◆ ucp_check()

constexpr bool Chusov::String::ucp_check ( ucp_t  ucp)
constexprnoexcept

Verifies the validity of a Unicode 11.0 code point.

Parameters
ucpis a code point to verify.
Returns
true, if the code point is valid, or false otherwise.

The code is considered if it is not a Unicode 11.0 surrogate and belongs to the valid range of valid code points. That is, the function returns true, if the value of ucp is less than 0xd800 or greater than 0xdfff and less than 0x110000.

Warning
Calling the function with a code point as a parameter is not equivalent to calling encoding checking functions such as u8_check because unlike them ucp_check does not perform per-byte checks and thus is faster but may not be enough to check a validity of a Unicode encoding.