12#include <boost/container/small_vector.hpp>
21template<
class C,
class CharT =
char>
22C basicTokenizeString(std::basic_string_view<CharT> s, std::basic_string_view<CharT> separators);
28C tokenizeString(std::string_view s, std::string_view separators =
" \t\n\r");
30extern template std::list<std::string> tokenizeString(std::string_view s, std::string_view separators);
31extern template StringSet tokenizeString(std::string_view s, std::string_view separators);
32extern template std::vector<std::string> tokenizeString(std::string_view s, std::string_view separators);
39template<
class C,
class CharT =
char>
40C basicSplitString(std::basic_string_view<CharT> s, std::basic_string_view<CharT> separators);
42C splitString(std::string_view s, std::string_view separators);
44extern template std::list<std::string> splitString(std::string_view s, std::string_view separators);
45extern template StringSet splitString(std::string_view s, std::string_view separators);
46extern template std::vector<std::string> splitString(std::string_view s, std::string_view separators);
52std::string concatStringsSep(
const std::string_view sep,
const C & ss);
54extern template std::string concatStringsSep(std::string_view,
const std::list<std::string> &);
55extern template std::string concatStringsSep(std::string_view,
const StringSet &);
56extern template std::string concatStringsSep(std::string_view,
const std::vector<std::string> &);
57extern template std::string concatStringsSep(std::string_view,
const boost::container::small_vector<std::string, 64> &);
62template<
class C,
class F>
63std::string concatMapStringsSep(std::string_view separator,
const C & iterable, F fn)
65 boost::container::small_vector<std::string, 64> strings;
66 strings.reserve(iterable.size());
67 for (
const auto & elem : iterable) {
68 strings.push_back(fn(elem));
70 return concatStringsSep(separator, strings);
82 "Consider removing the empty string dropping behavior. If acceptable, use concatStringsSep instead.")]] std::string
83dropEmptyInitThenConcatStringsSep(
const std::string_view sep,
const C & ss);
85extern template std::string dropEmptyInitThenConcatStringsSep(std::string_view,
const std::list<std::string> &);
86extern template std::string dropEmptyInitThenConcatStringsSep(std::string_view,
const StringSet &);
87extern template std::string dropEmptyInitThenConcatStringsSep(std::string_view,
const std::vector<std::string> &);
95std::list<std::string> shellSplitString(std::string_view s);
112std::string optionalBracket(std::string_view prefix, std::string_view content, std::string_view suffix);
126 requires std::convertible_to<T, std::string_view>
127std::string optionalBracket(std::string_view prefix,
const std::optional<T> & content, std::string_view suffix)
129 if (!content || std::string_view(*content).empty()) {
132 return optionalBracket(prefix, std::string_view(*content), suffix);
144 using HashType = std::hash<std::string_view>;
147 using is_transparent = void;
149 auto operator()(
const char * str)
const
155 return HashType{}(std::string_view{str});
158 auto operator()(std::string_view str)
const
160 return HashType{}(str);
163 auto operator()(
const std::string & str)
const
165 return HashType{}(std::string_view{str});
173const char * requireCString(
const std::string & str);
Definition strings.hh:142
std::set< std::string, std::less<> > StringSet
Definition types.hh:45