diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-06-24 22:58:50 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-06-24 22:58:50 +0100 |
| commit | 1d81b73df9922f0d3006a2d8031bf44f88573224 (patch) | |
| tree | 73d0a4686a0cb8bf20cdb385a9729ff8a09902fa /src/string.cpp | |
| parent | 18f885efabb98fb91ab0c6e9586a8b66eab511d9 (diff) | |
Basic command line flags: e.g. `-opt=0`
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); +} + |