aboutsummaryrefslogtreecommitdiff
path: root/src/string.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-06-24 22:58:50 +0100
committerGinger Bill <bill@gingerbill.org>2017-06-24 22:58:50 +0100
commit1d81b73df9922f0d3006a2d8031bf44f88573224 (patch)
tree73d0a4686a0cb8bf20cdb385a9729ff8a09902fa /src/string.cpp
parent18f885efabb98fb91ab0c6e9586a8b66eab511d9 (diff)
Basic command line flags: e.g. `-opt=0`
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 1795b411d..916e095e2 100644
--- a/src/string.cpp
+++ b/src/string.cpp
@@ -80,6 +80,13 @@ gb_inline String make_string_c(char *text) {
return make_string(cast(u8 *)cast(void *)text, gb_strlen(text));
}
+String substring(String s, isize lo, isize hi) {
+ isize max = s.len;
+ GB_ASSERT(lo <= hi && hi <= max);
+
+ return make_string(s.text+lo, hi-lo);
+}
+