* @brief Returns @c true if @a str has substring @a withWhat in area * bordered by offsets @a start and @a stop. */
| 711 | * bordered by offsets @a start and @a stop. |
| 712 | */ |
| 713 | bool 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 |