Count the number of codepoints in the given string (assuming it is valid UTF8).
| 556 | |
| 557 | /// Count the number of codepoints in the given string (assuming it is valid UTF8). |
| 558 | static inline int64_t UTF8Length(const uint8_t* first, const uint8_t* last) { |
| 559 | int64_t length = 0; |
| 560 | while (first != last) { |
| 561 | length += ((*first++ & 0xc0) != 0x80); |
| 562 | } |
| 563 | return length; |
| 564 | } |
| 565 | |
| 566 | } // namespace util |
| 567 | } // namespace arrow |