[#bsl-basic_string-0faf-compare-08] = xref:bsl.adoc[bsl]::xref:bsl/basic_string-0faf.adoc[basic_string]::compare :relfileprefix: ../../ :mrdocs: Lexicographically compare this string with the specified null‐terminated `other` string (of length `CHAR_TRAITS::length(other)`), 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. `CHAR_TRAITS::lt` is used to compare characters. See {Lexicographical Comparisons}. == Synopsis Declared in `<bslstl_string.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- int compare(CHAR_TYPE const* other) const; ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#