Updated test

This commit is contained in:
emeric
2025-11-16 20:56:55 +01:00
parent 106c30a293
commit 162d910904
3 changed files with 26 additions and 11 deletions
+2 -2
View File
@@ -418,11 +418,11 @@ namespace lms::core::stringUtils
}
}
std::string replaceInString(std::string_view str, const std::string& from, const std::string& to)
std::string replaceInString(std::string_view str, std::string_view from, std::string_view to)
{
std::string res{ str };
size_t pos = 0;
size_t pos = 0;
while ((pos = res.find(from, pos)) != std::string::npos)
{
res.replace(pos, from.length(), to);
+1 -1
View File
@@ -98,7 +98,7 @@ namespace lms::core::stringUtils
template<>
[[nodiscard]] std::optional<bool> readAs(std::string_view str);
[[nodiscard]] std::string replaceInString(std::string_view str, const std::string& from, const std::string& to);
[[nodiscard]] std::string replaceInString(std::string_view str, std::string_view from, std::string_view to);
[[nodiscard]] std::string jsEscape(std::string_view str);
[[nodiscard]] std::string jsonEscape(std::string_view str);