refactor(strhelpers): extract shared strReplaceAll helper (#7711)

Co-authored-by: philmoz <philmoz@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Peter Feerick
2026-08-27 09:39:10 +10:00
committed by GitHub
co-authored by philmoz Claude Sonnet 5
parent 2b9b8fd479
commit 8347285abe
9 changed files with 95 additions and 52 deletions
+11
View File
@@ -1314,3 +1314,14 @@ int timezoneOffsetSeconds(int8_t tzHour, int8_t tzMinute)
{
return (tzHour * 3600) + (tzMinute * 15 * 60);
}
void strReplaceAll(std::string &str, const std::string &from,
const std::string &to)
{
if (from.empty()) return;
size_t pos = 0;
while ((pos = str.find(from, pos)) != std::string::npos) {
str.replace(pos, from.length(), to);
pos += to.length();
}
}