aboutsummaryrefslogtreecommitdiff
path: root/src/string.cpp
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2025-08-02 11:55:16 +0100
committergingerBill <gingerBill@users.noreply.github.com>2025-08-02 11:55:16 +0100
commitae02d3d02d2eb5132fa7c6573ed7db20d7e18f3e (patch)
tree0f9f591df4a9862013ff79ef2e5ea3f8c050c393 /src/string.cpp
parent2561427dd396a69cd49eb02c0814c4e8e8b3a08f (diff)
Begin supporting `string16` across the core library
Diffstat (limited to 'src/string.cpp')
-rw-r--r--src/string.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/string.cpp b/src/string.cpp
index 8405938f4..8cc0e93f3 100644
--- a/src/string.cpp
+++ b/src/string.cpp
@@ -79,6 +79,13 @@ gb_internal String substring(String const &s, isize lo, isize hi) {
return make_string(s.text+lo, hi-lo);
}
+gb_internal String16 substring(String16 const &s, isize lo, isize hi) {
+ isize max = s.len;
+ GB_ASSERT_MSG(lo <= hi && hi <= max, "%td..%td..%td", lo, hi, max);
+
+ return make_string16(s.text+lo, hi-lo);
+}
+
gb_internal char *alloc_cstring(gbAllocator a, String s) {
char *c_str = gb_alloc_array(a, char, s.len+1);