| 534 | /*********************************************/ |
| 535 | |
| 536 | int String::compareTo(const char* cstr, size_t length) const |
| 537 | { |
| 538 | auto len = this->length(); |
| 539 | if(len == 0 || length == 0) { |
| 540 | return len - length; |
| 541 | } |
| 542 | auto buf = cbuffer(); |
| 543 | assert(buf != nullptr && cstr != nullptr); |
| 544 | if(len == length) { |
| 545 | return memcmp(buf, cstr, len); |
| 546 | } |
| 547 | if(len < length) { |
| 548 | return memcmp(buf, cstr, len) ?: -1; |
| 549 | } |
| 550 | return memcmp(buf, cstr, length) ?: 1; |
| 551 | } |
| 552 | |
| 553 | bool String::equals(const char* cstr) const |
| 554 | { |