FastLED 3.10.6
Loading...
Searching...
No Matches

◆ rfind() [3/4]

fl::size fl::basic_string::rfind ( const char * s,
fl::size pos,
fl::size count ) const

Definition at line 588 of file basic_string.cpp.hpp.

588 {
589 if (!s || count == 0) {
590 if (count == 0) return (pos > mLength) ? mLength : pos;
591 return npos;
592 }
593 if (count > mLength) return npos;
594 fl::size maxStart = mLength - count;
595 fl::size searchStart = (pos >= mLength || pos == npos) ? maxStart : pos;
596 if (searchStart + count > mLength) searchStart = maxStart;
597 const char* str = c_str();
598 for (fl::size i = searchStart + 1; i > 0; --i) {
599 fl::size idx = i - 1;
600 if (idx + count > mLength) continue;
601 bool match = true;
602 for (fl::size j = 0; j < count; ++j) {
603 if (str[idx + j] != s[j]) { match = false; break; }
604 }
605 if (match) return idx;
606 }
607 return npos;
608}
uint8_t pos
Definition Blur.ino:11
static constexpr fl::size npos
const char * c_str() const FL_NO_EXCEPT

References c_str(), mLength, npos, and pos.

+ Here is the call graph for this function: