FastLED 3.10.6
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 1181 of file basic_string.cpp.hpp.

1181 {
1182 if (!s) {
1183 if (pos1 >= mLength) return 0;
1184 fl::size actualCount1 = count1;
1185 if (actualCount1 == npos || pos1 + actualCount1 > mLength) {
1186 actualCount1 = mLength - pos1;
1187 }
1188 return (actualCount1 > 0) ? 1 : 0;
1189 }
1190 if (pos1 > mLength) return (s[0] == '\0') ? 0 : -1;
1191 fl::size actualCount1 = count1;
1192 if (actualCount1 == npos || pos1 + actualCount1 > mLength) {
1193 actualCount1 = mLength - pos1;
1194 }
1195 fl::size sLen = fl::strlen(s);
1196 fl::size minLen = (actualCount1 < sLen) ? actualCount1 : sLen;
1197 int result = fl::strncmp(c_str() + pos1, s, minLen);
1198 if (result != 0) return result;
1199 if (actualCount1 < sLen) return -1;
1200 if (actualCount1 > sLen) return 1;
1201 return 0;
1202}
static constexpr fl::size npos
const char * c_str() const FL_NO_EXCEPT
size_t strlen(const char *s) FL_NO_EXCEPT
expected< T, E > result
Alias for expected (Rust-style naming)
Definition result.h:31
int strncmp(const char *s1, const char *s2, size_t n) FL_NO_EXCEPT

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

+ Here is the call graph for this function: