[#bsl-basic_string-01d-compare-0de]
= xref:bsl.adoc[bsl]::xref:bsl/basic_string-01d.adoc[basic&lowbar;string&lt;char8&lowbar;t&gt;]::compare
:relfileprefix: ../../
:mrdocs:

Lexicographically compare this string with the specified `other` string, and return a negative value if this string is less than `other`, a positive value if it is greater than `other`, and 0 in case of equality&period; `CHAR&lowbar;TRAITS&colon;&colon;lt` is used to compare characters&period; See &lcub;Lexicographical Comparisons&rcub;&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;string&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
compare(xref:bsl/basic_string-0faf.adoc[basic&lowbar;string&lt;char8&lowbar;t&gt;] const& other) const noexcept;
----


[.small]#Created with https://www.mrdocs.com[MrDocs]#
