string (1) | int compare (const basic_string& str) const; |
---|---|
substrings (2) | int compare (size_type pos, size_type len, const basic_string& str) const;int compare (size_type pos, size_type len, const basic_string& str, size_type subpos, size_type sublen) const; |
c-string (3) | int compare (const charT* s) const;int compare (size_type pos, size_type len, const charT* s) const; |
buffer (4) | int compare (size_type pos, size_type len, const charT* s, size_type n) const; |
string (1) | int compare (const basic_string& str) const noexcept; |
---|---|
substrings (2) | int compare (size_type pos, size_type len, const basic_string& str) const;int compare (size_type pos, size_type len, const basic_string& str, size_type subpos, size_type sublen) const; |
c-string (3) | int compare (const charT* s) const;int compare (size_type pos, size_type len, const charT* s) const; |
buffer (4) | int compare (size_type pos, size_type len, const charT* s, size_type n) const; |
string (1) | int compare (const basic_string& str) const noexcept; |
---|---|
substrings (2) | int compare (size_type pos, size_type len, const basic_string& str) const;int compare (size_type pos, size_type len, const basic_string& str, size_type subpos, size_type sublen = npos) const; |
c-string (3) | int compare (const charT* s) const;int compare (size_type pos, size_type len, const charT* s) const; |
buffer (4) | int compare (size_type pos, size_type len, const charT* s, size_type n) const; |
值 | 被比較字串和比較字串之間的關係 |
---|---|
0 | 它們比較相等 |
<0 | 被比較字串中第一個不匹配的字元的值較低,或者所有比較的字元都匹配,但被比較字串較短。 |
>0 | 被比較字串中第一個不匹配的字元的值較高,或者所有比較的字元都匹配,但被比較字串較長。 |
|
|
green apple is not red apple still, green apple is an apple and red apple is also an apple therefore, both are apples |