diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2022-07-26 00:43:48 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2022-07-26 00:43:48 +0300 |
commit | f081e76037432cb926be45e980eac201d337032c (patch) | |
tree | dd1225521c12ea21c0b0c3d51ec1ae3f8730755f /intern/cycles/util/string.cpp | |
parent | fa2084ae58a77b1201289b6bedac427f73c762d1 (diff) | |
parent | 462f99bf38648a08226b1fba423315aec2bc577b (diff) |
Merge branch 'master' into geometry-nodes-iterative-cachegeometry-nodes-rigid-body-integration
Diffstat (limited to 'intern/cycles/util/string.cpp')
-rw-r--r-- | intern/cycles/util/string.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/intern/cycles/util/string.cpp b/intern/cycles/util/string.cpp index 66ff866ee10..0c318cea44a 100644 --- a/intern/cycles/util/string.cpp +++ b/intern/cycles/util/string.cpp @@ -136,6 +136,19 @@ void string_replace(string &haystack, const string &needle, const string &other) } } +void string_replace_same_length(string &haystack, const string &needle, const string &other) +{ + assert(needle.size() == other.size()); + size_t pos = 0; + while (pos != string::npos) { + pos = haystack.find(needle, pos); + if (pos != string::npos) { + memcpy(haystack.data() + pos, other.data(), other.size()); + pos += other.size(); + } + } +} + string string_remove_trademark(const string &s) { string result = s; @@ -164,6 +177,11 @@ string to_string(const char *str) return string(str); } +string to_string(const float4 &v) +{ + return string_printf("%f,%f,%f,%f", v.x, v.y, v.z, v.w); +} + string string_to_lower(const string &s) { string r = s; |