MCPcopy Create free account
hub / github.com/Rezonality/zep / string_slurp_if

Function string_slurp_if

src/mcommon/string/stringutils.cpp:331–355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

329}
330
331std::string string_slurp_if(std::string::const_iterator& itr, std::string::const_iterator itrEnd, char first, char last)
332{
333 if (itr == itrEnd)
334 {
335 return "";
336 }
337
338 auto itrCurrent = itr;
339 if (*itrCurrent == first)
340 {
341 while ((itrCurrent != itrEnd) && *itrCurrent != last)
342 {
343 itrCurrent++;
344 }
345
346 if ((itrCurrent != itrEnd) && *itrCurrent == last)
347 {
348 itrCurrent++;
349 auto ret = std::string(itr, itrCurrent);
350 itr = itrCurrent;
351 return ret;
352 }
353 }
354 return "";
355}
356
357std::string string_slurp_if(std::string::const_iterator& itr, std::string::const_iterator itrEnd, std::function<bool(char)> fnIs)
358{

Callers 1

keymap_findFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected