Replace boost::replace_all and boost::ireplace_all

Replaced with custom functions using std::string_view to remove Boost
dependency and reduce template instantiation, keeping original
behavior.

Tested: added UT and verified all tests passed

Change-Id: I82cc238c800c7780dc50b6a40445657931bf5250
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/src/utils.cpp b/src/utils.cpp
index 171c236..de433c8 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -3,7 +3,6 @@
 
 #include "utils.hpp"
 
-#include <boost/algorithm/string/replace.hpp>
 #include <boost/container/flat_map.hpp>
 #include <boost/lexical_cast.hpp>
 #include <phosphor-logging/lg2.hpp>
@@ -199,3 +198,40 @@
 
     return out;
 }
+
+void iReplaceAll(std::string& str, std::string_view search,
+                 std::string_view replace)
+{
+    if (search.empty() || search == replace)
+    {
+        return;
+    }
+
+    while (true)
+    {
+        std::ranges::subrange<std::string::iterator> match =
+            iFindFirst(str, search);
+        if (!match)
+        {
+            break;
+        }
+
+        str.replace(match.begin(), match.end(), replace.begin(), replace.end());
+    }
+}
+
+void replaceAll(std::string& str, std::string_view search,
+                std::string_view replace)
+{
+    if (search.empty())
+    {
+        return;
+    }
+
+    size_t pos = 0;
+    while ((pos = str.find(search, pos)) != std::string::npos)
+    {
+        str.replace(pos, search.size(), replace);
+        pos += replace.size();
+    }
+}