MCPcopy Create free account
hub / github.com/IoLanguage/io / UArray_numberOfCharacters

Function UArray_numberOfCharacters

libs/basekit/source/UArray_utf.c:80–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80size_t UArray_numberOfCharacters(const UArray *self) {
81 if (self->encoding == CENCODING_UTF8) {
82 size_t numChars = 0;
83 size_t i = 0;
84
85 while (i < self->size) {
86 int charSize = UArray_SizeOfUTF8Char(self->data + i);
87 if (charSize == -1)
88 return 0;
89 numChars++;
90 i += charSize;
91 }
92
93 return numChars;
94 }
95
96 return self->size;
97}
98
99int UArray_convertToFixedSizeType(UArray *self) {
100 if (self->encoding == CENCODING_UTF8) {

Callers 2

UArray_asUCS2Function · 0.85
UArray_asUCS4Function · 0.85

Calls 1

UArray_SizeOfUTF8CharFunction · 0.85

Tested by

no test coverage detected