summaryrefslogtreecommitdiff
path: root/asl/string_view.hpp
diff options
context:
space:
mode:
authorSteven Le Rouzic <steven.lerouzic@gmail.com>2024-11-28 23:53:55 +0100
committerSteven Le Rouzic <steven.lerouzic@gmail.com>2024-12-20 15:35:58 +0100
commit27c3969e69f5525ccb0bc462a615a14142b5f178 (patch)
treea11ebc28cb6c2609d5e04913f63d5c1ba1181e0e /asl/string_view.hpp
parent3dc9bc3a6cefa30c553c6ec21b1545db98e26b6d (diff)
Add float utilities, & float formatting with dragonbox
Diffstat (limited to 'asl/string_view.hpp')
-rw-r--r--asl/string_view.hpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/asl/string_view.hpp b/asl/string_view.hpp
index 51d4234..c75695c 100644
--- a/asl/string_view.hpp
+++ b/asl/string_view.hpp
@@ -70,6 +70,16 @@ public:
return string_view{m_data + offset, m_size - offset}; // NOLINT(*-pointer-arithmetic)
}
+ constexpr string_view first(isize_t size) const
+ {
+ return substr(0, size);
+ }
+
+ constexpr string_view last(isize_t size) const
+ {
+ return substr(m_size - size);
+ }
+
constexpr bool operator==(string_view other) const
{
if (m_size != other.m_size) { return false; }