Program Listing for File string_util.hpp

Return to documentation for file (morpheus/_lib/include/morpheus/utilities/string_util.hpp)

Copy
Copied!
            

#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

© Copyright 2023, NVIDIA. Last updated on Feb 3, 2023.