MCPcopy Create free account
hub / github.com/ashvardanian/StringZilla / utf8_count

Method utf8_count

include/stringzilla/stringzilla.hpp:4179–4184  ·  view source on GitHub ↗

* @brief Count UTF-8 characters in the string (not bytes). * @return The number of UTF-8 codepoints. */

Source from the content-addressed store, hash-verified

4177 * @return The number of UTF-8 codepoints.
4178 */
4179 size_type utf8_count() const noexcept {
4180 sz_ptr_t start;
4181 sz_size_t length;
4182 sz_string_range(&string_, &start, &length);
4183 return sz_utf8_count(start, length);
4184 }
4185
4186 /**
4187 * @brief Find the byte offset of the nth UTF-8 character.

Callers 3

test_unit_utf8_countFunction · 0.45
sz_utf8_countFunction · 0.45

Calls 2

sz_string_rangeFunction · 0.85
sz_utf8_countFunction · 0.70

Tested by 1

test_unit_utf8_countFunction · 0.36