diff --git a/fable/include/fable/utility/string.hpp b/fable/include/fable/utility/string.hpp index c52410a4c..f217bbc6f 100644 --- a/fable/include/fable/utility/string.hpp +++ b/fable/include/fable/utility/string.hpp @@ -20,12 +20,23 @@ * \see fable/utility/string.cpp */ +#pragma once + #include // for string #include // for string_view #include // for vector<> namespace fable { +inline bool starts_with(std::string_view s, std::string_view prefix) { + return s.size() >= prefix.size() && s.compare(0, prefix.size(), prefix) == 0; +} + +inline bool ends_with(std::string_view s, std::string_view suffix) { + return s.size() >= suffix.size() && + s.compare(s.size() - suffix.size(), std::string::npos, suffix) == 0; +} + std::string join_vector(const std::vector& v, std::string_view sep); /**