From dc20dfe6489ebca9f51ab07c4a47a66c45a2eeda Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 4 Feb 2021 17:21:57 +0100 Subject: [PATCH] moved replace_str to util --- raycaster.cpp | 5 ----- util.cpp | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/raycaster.cpp b/raycaster.cpp index c0107cac..f52fad88 100644 --- a/raycaster.cpp +++ b/raycaster.cpp @@ -215,11 +215,6 @@ string build_getter(string type, string name, int index) { #define GET(array, index) array "[" index "]" #endif -void replace_str(string& s, string a, string b) { - while(s.find(a) != string::npos) - s.replace(s.find(a), isize(a), b); - } - EX hookset hooks_rayshader; EX hookset)> hooks_rayset; diff --git a/util.cpp b/util.cpp index 0768bae8..2cd6d4a0 100644 --- a/util.cpp +++ b/util.cpp @@ -690,6 +690,12 @@ bignum::bignum(ld d) { while(n >= 0) { digits[n] = int(d); d -= digits[n]; d *= BASE; n--; } } +/** in s, replace occurences of a with b */ +EX void replace_str(string& s, string a, string b) { + while(s.find(a) != string::npos) + s.replace(s.find(a), isize(a), b); + } + #if CAP_ZLIB /* compression/decompression */