moved replace_str to util

This commit is contained in:
Zeno Rogue 2021-02-04 17:21:57 +01:00
parent a3574a2c13
commit dc20dfe648
2 changed files with 6 additions and 5 deletions

View File

@ -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<void(string&, string&)> hooks_rayshader;
EX hookset<bool(shared_ptr<raycaster>)> hooks_rayset;

View File

@ -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 */