diff options
Diffstat (limited to 'src/string.cpp')
| -rw-r--r-- | src/string.cpp | 7 |
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); +} + |