MCPcopy Create free account
hub / github.com/NVIDIA-RTX/RTXPT / FindSubStringIgnoreCase

Function FindSubStringIgnoreCase

Rtxpt/SampleCommon/SampleCommon.cpp:618–641  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

616}
617
618size_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
643bool EqualsIgnoreCase(const std::string & a, const std::string & b)
644{

Callers 3

buildUIMethod · 0.85
LoadMethod · 0.85
ModelTypeMethod · 0.85

Calls 1

emptyMethod · 0.80

Tested by

no test coverage detected