MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / _hx_utf8_length

Function _hx_utf8_length

src/String.cpp:694–714  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

692}
693
694int _hx_utf8_length(String inString)
695{
696 #ifdef HX_SMART_STRINGS
697 return inString.length;
698 #else
699
700 const unsigned char *src = (const unsigned char *)inString.__s;
701 const unsigned char *end = src + inString.length;
702
703 int len = 0;
704 const unsigned char *sLen = getUtf8LenArray();
705 while(src<end)
706 {
707 src += sLen[*src];
708 len++;
709 }
710 if (src>end)
711 hx::Throw(HX_CSTRING("Invalid UTF8"));
712 return len;
713 #endif
714}
715
716bool _hx_utf8_is_valid(String inString)
717{

Callers

nothing calls this directly

Calls 2

getUtf8LenArrayFunction · 0.85
ThrowFunction · 0.85

Tested by

no test coverage detected