From 1d81b73df9922f0d3006a2d8031bf44f88573224 Mon Sep 17 00:00:00 2001 From: Ginger Bill Date: Sat, 24 Jun 2017 22:58:50 +0100 Subject: Basic command line flags: e.g. `-opt=0` --- src/string.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/string.cpp') 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); +} + -- cgit v1.2.3