| 616 | } |
| 617 | |
| 618 | size_t FindSubStringIgnoreCase(const std::string & text, const std::string & subString) |
| 619 | { |
| 620 | auto toLower = [](char ch) |
| 621 | { |
| 622 | return static_cast<char>(std::tolower(static_cast<unsigned char>(ch))); |
| 623 | }; |
| 624 | |
| 625 | if (subString.empty() || text.size() < subString.size()) |
| 626 | return std::string::npos; |
| 627 | |
| 628 | for (size_t i = 0; i <= text.size() - subString.size(); ++i) { |
| 629 | bool match = true; |
| 630 | for (size_t j = 0; j < subString.size(); ++j) { |
| 631 | if (toLower(text[i + j]) != toLower(subString[j])) { |
| 632 | match = false; |
| 633 | break; |
| 634 | } |
| 635 | } |
| 636 | if (match) |
| 637 | return i; |
| 638 | } |
| 639 | |
| 640 | return std::string::npos; |
| 641 | } |
| 642 | |
| 643 | bool EqualsIgnoreCase(const std::string & a, const std::string & b) |
| 644 | { |