MCPcopy Create free account
hub / github.com/avast/retdec / hasSubstringInArea

Function hasSubstringInArea

src/utils/string.cpp:713–724  ·  view source on GitHub ↗

* @brief Returns @c true if @a str has substring @a withWhat in area * bordered by offsets @a start and @a stop. */

Source from the content-addressed store, hash-verified

711* bordered by offsets @a start and @a stop.
712*/
713bool hasSubstringInArea(const std::string &str, const std::string &withWhat,
714 std::string::size_type start, std::string::size_type stop) {
715 if (start > stop) {
716 return false;
717 }
718
719 const auto stopIndex = stop + 1;
720 const auto stopIterator = stopIndex < str.size() ?
721 str.begin() + stopIndex : str.end();
722 return std::search(str.begin() + start, stopIterator, withWhat.begin(),
723 withWhat.end()) != stopIterator;
724}
725
726/**
727* @brief Returns @c true if @a str is composed solely of chars in @a chars, @c

Callers 2

hasStringMethod · 0.85
TEST_FFunction · 0.85

Calls 3

sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by 1

TEST_FFunction · 0.68