↰ Return to documentation for file (morpheus/_lib/include/morpheus/utilities/string_util.hpp
)
#pragma once
#include <sstream>
#include <string>
namespace morpheus {
#define MORPHEUS_CONCAT_STR(strs) ((std::ostringstream&)(std::ostringstream() << strs)).str()
/****** Component public implementations *******************/
/****** StringUtil****************************************/
struct StringUtil
{
template <typename IterT>
static std::string join(IterT begin, IterT end, std::string const& separator)
{
std::ostringstream result;
if (begin != end)
result << *begin++;
while (begin != end)
result << separator << *begin++;
return result.str();
}
template <typename IterT>
static std::string array_to_str(IterT begin, IterT end)
{
return MORPHEUS_CONCAT_STR("[" << join(begin, end, ", ") << "]");
}
static bool str_contains(const std::string& str, const std::string& search_str);
}; // end of group
} // namespace morpheus