FastLED 3.9.15
Loading...
Searching...
No Matches

◆ compare() [5/6]

int fl::basic_string::compare ( fl::size pos1,
fl::size count1,
const char * s ) const

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

1157 {
1158 if (!s) {
1159 if (pos1 >= mLength) return 0;
1160 fl::size actualCount1 = count1;
1161 if (actualCount1 == npos || pos1 + actualCount1 > mLength) {
1162 actualCount1 = mLength - pos1;
1163 }
1164 return (actualCount1 > 0) ? 1 : 0;
1165 }
1166 if (pos1 > mLength) return (s[0] == '\0') ? 0 : -1;
1167 fl::size actualCount1 = count1;
1168 if (actualCount1 == npos || pos1 + actualCount1 > mLength) {
1169 actualCount1 = mLength - pos1;
1170 }
1171 fl::size sLen = fl::strlen(s);
1172 fl::size minLen = (actualCount1 < sLen) ? actualCount1 : sLen;
1173 int result = fl::strncmp(c_str() + pos1, s, minLen);
1174 if (result != 0) return result;
1175 if (actualCount1 < sLen) return -1;
1176 if (actualCount1 > sLen) return 1;
1177 return 0;
1178}
static constexpr fl::size npos
const char * c_str() const FL_NOEXCEPT
int strncmp(const char *s1, const char *s2, size_t n) FL_NOEXCEPT
size_t strlen(const char *s) FL_NOEXCEPT
expected< T, E > result
Alias for expected (Rust-style naming)
Definition result.h:31

References c_str(), mLength, npos, fl::strlen(), and fl::strncmp().

+ Here is the call graph for this function: