From 7575bc46f1948697dd753ab543c50b795b638420 Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Tue, 8 Dec 2020 08:06:20 -0600 Subject: [PATCH] added str.read_chars --- core/string.onyx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/string.onyx b/core/string.onyx index 66f3b2a2..814ee00f 100644 --- a/core/string.onyx +++ b/core/string.onyx @@ -336,6 +336,13 @@ read_char :: proc (str: ^string, out: ^u8) { str.count -= 1; } +read_chars :: proc (str: ^string, out: ^string, char_count := 1) { + out.data = str.data; + out.count = char_count; + str.data += char_count; + str.count -= char_count; +} + discard_chars :: proc (str: ^string, char_count := 1) { str.data += char_count; str.count -= char_count; -- 2.25.1