1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:07:45 +00:00

AK: Add Utf8View::byte_offset_of overload for code point index lookups

This commit is contained in:
Timothy Flynn 2021-08-16 10:27:26 -04:00 committed by Ali Mohammad Pur
parent a9716ad44e
commit c4ee576531
2 changed files with 16 additions and 0 deletions

View file

@ -67,6 +67,7 @@ public:
const unsigned char* bytes() const { return begin_ptr(); }
size_t byte_length() const { return m_string.length(); }
size_t byte_offset_of(const Utf8CodePointIterator&) const;
size_t byte_offset_of(size_t code_point_offset) const;
Utf8View substring_view(size_t byte_offset, size_t byte_length) const;
Utf8View substring_view(size_t byte_offset) const { return substring_view(byte_offset, byte_length() - byte_offset); }