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

◆ compare() [6/6]

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

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

1204 {
1205 if (!s) {
1206 if (pos1 >= mLength) return (count2 == 0) ? 0 : -1;
1207 fl::size actualCount1 = count1;
1208 if (actualCount1 == npos || pos1 + actualCount1 > mLength) {
1209 actualCount1 = mLength - pos1;
1210 }
1211 return (actualCount1 > 0) ? 1 : ((count2 == 0) ? 0 : -1);
1212 }
1213 if (pos1 > mLength) return (count2 == 0) ? 0 : -1;
1214 fl::size actualCount1 = count1;
1215 if (actualCount1 == npos || pos1 + actualCount1 > mLength) {
1216 actualCount1 = mLength - pos1;
1217 }
1218 fl::size minLen = (actualCount1 < count2) ? actualCount1 : count2;
1219 int result = fl::strncmp(c_str() + pos1, s, minLen);
1220 if (result != 0) return result;
1221 if (actualCount1 < count2) return -1;
1222 if (actualCount1 > count2) return 1;
1223 return 0;
1224}
static constexpr fl::size npos
const char * c_str() const 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, and fl::strncmp().

+ Here is the call graph for this function: