summaryrefslogtreecommitdiff
path: root/AK/Utf8View.h
diff options
context:
space:
mode:
Diffstat (limited to 'AK/Utf8View.h')
-rw-r--r--AK/Utf8View.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/AK/Utf8View.h b/AK/Utf8View.h
index f8c0553923..624eab7cbd 100644
--- a/AK/Utf8View.h
+++ b/AK/Utf8View.h
@@ -141,6 +141,18 @@ public:
return value;
}
+ [[nodiscard]] Optional<u32> peek() const
+ {
+ if (m_it.done())
+ return {};
+ return *m_it;
+ }
+
+ [[nodiscard]] size_t byte_offset() const
+ {
+ return Utf8View(m_string).byte_offset_of(m_it);
+ }
+
DeprecatedStringCodePointIterator(DeprecatedString string)
: m_string(move(string))
, m_it(Utf8View(m_string).begin())