chsvlib
chsv helper source code

◆ u8_check()

constexpr bool Chusov::String::u8_check ( const char *  pStr,
std::size_t  cbStr 
)
constexprnoexcept

Verifies the validity of a UTF-8 code and its byte size.

Parameters
pStrspecifies a pointer to the first byte of the UTF-8 character.
cbStra byte size of the code. The size must be exactly equal to the actual byte length of the UTF-8 character pointed to by pStr.
Returns
true if the code pointed to by pStr of size cbStr matches exactly one complete UTF-8 character. false otherwise.

The function performs all checks defined in the section 3.9 of the Unicode 11.0 standard for the UTF-8 encoding, that is unlike faster ucp_check function.