Base: add helper function to quote a string and join a list of strings

This commit is contained in:
wmayer
2023-05-15 23:40:07 +02:00
parent 112ffc9d87
commit 98a4b1d399
3 changed files with 57 additions and 0 deletions

View File

@@ -291,6 +291,30 @@ std::string Base::Tools::escapeEncodeFilename(const std::string& s)
return result;
}
std::string Base::Tools::quoted(const char* name)
{
std::stringstream str;
str << "\"" << name << "\"";
return str.str();
}
std::string Base::Tools::quoted(const std::string& name)
{
std::stringstream str;
str << "\"" << name << "\"";
return str.str();
}
std::string Base::Tools::joinList(const std::vector<std::string>& vec,
const std::string& sep)
{
std::stringstream str;
for (const auto& it : vec) {
str << it << sep;
}
return str.str();
}
// ----------------------------------------------------------------------------
using namespace Base;