| 449 | return str.size() >= suffix.size() && str.compare(str.size()-suffix.size(), suffix.size(), suffix) == 0; |
| 450 | } |
| 451 | size_t string_find_partial_stop(const std::string_view & str, const std::string_view & stop) { |
| 452 | if (!str.empty() && !stop.empty()) { |
| 453 | const char text_last_char = str.back(); |
| 454 | for (int64_t char_index = stop.size() - 1; char_index >= 0; char_index--) { |
| 455 | if (stop[char_index] == text_last_char) { |
| 456 | const auto current_partial = stop.substr(0, char_index + 1); |
| 457 | if (string_ends_with(str, current_partial)) { |
| 458 | return str.size() - char_index - 1; |
| 459 | } |
| 460 | } |
| 461 | } |
| 462 | } |
| 463 | |
| 464 | return std::string::npos; |
| 465 | } |
| 466 | |
| 467 | std::string regex_escape(const std::string & s) { |
| 468 | static const std::regex special_chars("[.^$|()*+?\\[\\]{}\\\\]"); |
no test coverage detected