utils: trim(): Take string_view

Esse commit está contido em:
Albert S. 2021-10-10 12:01:16 +02:00
commit 9593429f95
2 arquivos alterados com 2 adições e 3 exclusões

Ver arquivo

@ -182,10 +182,9 @@ std::string utils::toISODate(time_t t)
return std::string{result}; return std::string{result};
} }
std::string utils::trim(const std::string &str) std::string utils::trim(std::string_view view)
{ {
std::string_view chars = " \t\n\r"; std::string_view chars = " \t\n\r";
std::string_view view = str;
auto n = view.find_first_not_of(chars); auto n = view.find_first_not_of(chars);
if(n != std::string_view::npos) if(n != std::string_view::npos)
{ {

Ver arquivo

@ -93,7 +93,7 @@ template <class T> inline std::string toString(const T &v)
return std::string(v.begin(), v.end()); return std::string(v.begin(), v.end());
} }
std::string trim(const std::string &str); std::string trim(std::string_view view);
} // namespace utils } // namespace utils
#endif #endif