14 lines
159 B
C
14 lines
159 B
C
|
#ifndef _UTF8_STRLEN
|
||
|
#define _UTF8_STRLEN
|
||
|
|
||
|
size_t utf8_strlen(const char *s) {
|
||
|
size_t i = 0;
|
||
|
|
||
|
while (*s++)
|
||
|
i += (*s & 0xC0) != 0x80;
|
||
|
|
||
|
return i;
|
||
|
}
|
||
|
|
||
|
#endif
|