language-extensions/R/common/src/Unicode.cpp
// -------------------------------------------------------------------------------------------------
// Name: Utf8Size
//
// Description:
//  Returns the number of chars (bytes) in the UTF8 representation of the string
//
Utf8Size
Description:
Returns the number of chars (bytes) in the UTF8 representation of the string
Utf8Size Description : Returns the number of chars ( bytes ) in the UTF8 representation of the string
size_t Utf8Size(const char16_t *s, size_t l)
{
	size_t ans = 0;
	size_t i = 0;
	while (i < l)
	{
		char32_t char32;
		size_t char16Len;
		GetChar32(s + i, l - i, &char32, &char16Len);
		ans += GetChar8Len(char32);
		i += char16Len;
	}
	return ans;
}
size_t Utf8Size ( const char16_t * s , size_t l ) { size_t ans = 0 ; size_t i = 0 ; while ( i < l ) { char32_t char32 ; size_t char16Len ; GetChar32 ( s + i , l - i , & char32 , & char16Len ) ; ans += GetChar8Len ( char32 ) ; i += char16Len ; } return ans ; }
Name: Utf8Size
Description:
Returns the number of chars (bytes) in the UTF8 representation of the string
Name : Utf8Size Description : Returns the number of chars ( bytes ) in the UTF8 representation of the string