66 std::string_view line,
67 std::string_view delimiters =
"\"',;: ",
68 PredicateT&& predicate = [](ValueT&& s) -> ValueT {
return s; })
70 using value_type = ValueT;
74 ContainerT _result = {};
80 if(delimiters.find(itr) != std::string::npos) ++_nmax;
84 while(_beginp < line.length() && _delimp < line.length())
87 _beginp = line.find_first_not_of(delimiters, _delimp);
90 if(_beginp == std::string::npos)
break;
92 _delimp = line.find_first_of(delimiters, _beginp);
94 auto _tmp = value_type{};
97 if(_beginp < line.length()) _tmp = line.substr(_beginp, _delimp - _beginp);
102 mpl::emplace(_result, std::forward<PredicateT>(predicate)(std::move(_tmp)));
116 std::string_view line,
117 const std::vector<DelimT>& delimiters,
118 PredicateT&& predicate = [](DelimT&& s) -> ValueT {
return ValueT{s}; })
120 ContainerT _result = {};
122 size_t _end = std::string::npos;
124 while(_start != std::string::npos)
126 _end = std::string::npos;
129 for(
const auto& itr : delimiters)
131 size_t pos = line.find(itr, _start);
132 if(pos != std::string::npos && (_end == std::string::npos || pos < _end))
139 if(_end != std::string::npos)
142 std::forward<PredicateT>(predicate)(line.substr(_start, _end - _start)));
146 for(
const auto& delimiter : delimiters)
148 if(line.compare(_start, delimiter.size(), delimiter) == 0)
150 _start += delimiter.size();
158 mpl::emplace(_result, std::forward<PredicateT>(predicate)(line.substr(_start)));
171 std::string_view _begin,
172 std::string_view _end,
173 PredicateT&& predicate)
177 std::string _result = std::string{input};
178 while(_beg_pos < _result.length() && _end_pos < _result.length())
181 _beg_pos = _result.find(_begin, _end_pos);
184 if(_beg_pos == std::string::npos)
break;
188 _end_pos = _result.find(_end, _beg_pos + 1);
190 _end_pos = _beg_pos + _begin.length();
193 if(_end_pos == std::string::npos)
break;
196 auto _len = _end_pos - _beg_pos;
199 auto _sub = _result.substr(_beg_pos, _len);
202 auto _transformed = predicate(_sub);
205 if(_sub != _transformed)
207 _result = _result.replace(_beg_pos, _len, _transformed);
209 _end_pos = _beg_pos + _transformed.length();