Encoding#
UTF-8 validation and codepoint counting facilities.
Info
To use declarations from this page, include the <essence/encoding.hpp> header.
-
usize encoding::count(std::string_view s)#
Count the UTF-8 codepoints in a string. May also be called with a const char* or const std::string&
Example
std::string micro { "µ" }; assert(micro.length() == 2); assert(encoding::count(micro) == 1);
-
bool encoding::validate(std::string_view s)#
Determine UTF-8 validity of a string. May also be called with a const char* or const std::string&