diff options
| author | 2026-03-14 00:48:38 +0000 | |
|---|---|---|
| committer | 2026-03-14 02:16:21 +0000 | |
| commit | e1adfe5b9724c359ceb5c4d63043ee682a05f5eb (patch) | |
| tree | 0e136db93d72d792394ac749b27e748afe2c29cd /src/stringutils.cpp | |
| parent | Rewrite tokenstream and move to stringutils. (diff) | |
Convert some methods to use string_view.
Diffstat (limited to 'src/stringutils.cpp')
| -rw-r--r-- | src/stringutils.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/stringutils.cpp b/src/stringutils.cpp index 816cdd85b..a38063c31 100644 --- a/src/stringutils.cpp +++ b/src/stringutils.cpp @@ -216,7 +216,7 @@ std::string Base64::Decode(const void* data, size_t length, const char* table) return buffer; } -std::string Template::Replace(const std::string& str, const VariableMap& vars) +std::string Template::Replace(const std::string_view& str, const VariableMap& vars) { std::string out; out.reserve(str.length()); @@ -241,7 +241,8 @@ std::string Template::Replace(const std::string& str, const VariableMap& vars) break; } - auto var = vars.find(str.substr(idx + 1, endidx - idx - 1)); + const std::string varname(str.substr(idx + 1, endidx - idx - 1)); + const auto var = vars.find(varname); if (var != vars.end()) { // We have a variable, replace it in the string. |
