From: Brendan Hansen Date: Tue, 26 Oct 2021 13:08:45 +0000 (-0500) Subject: added string.replace X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=7df5713322f85c2726bdc9167b0f4d3a4846fcdd;p=onyx.git added string.replace --- diff --git a/core/string.onyx b/core/string.onyx index aa639618..9b6da85d 100644 --- a/core/string.onyx +++ b/core/string.onyx @@ -261,6 +261,12 @@ advance :: #match { } } +replace :: (s: str, to_replace: u8, replace_with: u8) { + for ^c: str { + if *c == to_replace do *c = replace_with; + } +} + read_until :: (s: ^str, upto: u8, skip := 0) -> str { if s.count == 0 do return "";