diff --git a/BaseLib/FileTools.cpp b/BaseLib/FileTools.cpp index fabf7b3da6579dbf57a2ae416c0cae5a29c4e848..e5145ffc74f2ce85d71b94ce28ed56834fc37157 100644 --- a/BaseLib/FileTools.cpp +++ b/BaseLib/FileTools.cpp @@ -111,9 +111,10 @@ bool substituteKeyword(std::string& result, std::string& parenthesized_string, std::string const generated_fmt_string = "{" + precision_specification + type_specification[std::type_index(typeid(data))] + "}"; - result = result.substr(0, begin) + - fmt::vformat(generated_fmt_string, fmt::make_format_args(data)) + - result.substr(end + 1, result.length() - (end + 1)); + result.replace( + begin, end - begin + 1, + fmt::vformat(generated_fmt_string, fmt::make_format_args(data))); + return true; }