| string (1) | int compare (const string& str) const; |
|---|---|
| substrings (2) | int compare (size_t pos, size_t len, const string& str) const;int compare (size_t pos, size_t len, const string& str, size_t subpos, size_t sublen) const; |
| c-string (3) | int compare (const char* s) const;int compare (size_t pos, size_t len, const char* s) const; |
| buffer (4) | int compare (size_t pos, size_t len, const char* s, size_t n) const; |
| string (1) | int compare (const string& str) const noexcept; |
|---|---|
| substrings (2) | int compare (size_t pos, size_t len, const string& str) const;int compare (size_t pos, size_t len, const string& str, size_t subpos, size_t sublen) const; |
| c-string (3) | int compare (const char* s) const;int compare (size_t pos, size_t len, const char* s) const; |
| buffer (4) | int compare (size_t pos, size_t len, const char* s, size_t n) const; |
| string (1) | int compare (const string& str) const noexcept; |
|---|---|
| substrings (2) | int compare (size_t pos, size_t len, const string& str) const;int compare (size_t pos, size_t len, const string& str, size_t subpos, size_t sublen = npos) const; |
| c-string (3) | int compare (const char* s) const;int compare (size_t pos, size_t len, const char* s) const; |
| buffer (4) | int compare (size_t pos, size_t len, const char* s, size_t n) const; |
| value | relation between compared string and comparing string |
|---|---|
| 0 | They compare equal |
| <0 | Either the value of the first character that does not match is lower in the compared string, or all compared characters match but the compared string is shorter. |
| >0 | Either the value of the first character that does not match is greater in the compared string, or all compared characters match but the compared string is longer. |
|
|
green apple is not red apple still, green apple is an apple and red apple is also an apple therefore, both are apples |