size_t count_utf8_code_points(const char *s) {
size_t count = 0;
while (*s) {
count += (*s++ & 0xC0) != 0x80;
}
return count;
}
size_t count_utf8_code_points(const char *s) {
size_t count = 0;
while (*s) {
count += (*s++ & 0xC0) != 0x80;
}
return count;
}
本文标题:C - strlen() for utf-8 string
本文链接:https://www.haomeiwen.com/subject/rusjhktx.html
网友评论