[#bsl-basic_string-0faf-compare-0b]
= xref:bsl.adoc[bsl]::xref:bsl/basic_string-0faf.adoc[basic&lowbar;string]::compare
:relfileprefix: ../../
:mrdocs:

Lexicographically compare this string with another sequence&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/size_type.adoc[size&lowbar;type] lhsPosition,
    xref:bsl/basic_string-0faf/size_type.adoc[size&lowbar;type] lhsNumChars,
    CHAR&lowbar;TYPE const* other) const;
----

== Return Value

negative, zero, or positive according to the lexicographic order

== Parameters

[cols="1,4"]
|===
| Name| Description
| *lhsPosition*
| starting index of the left&hyphen;hand substring
| *lhsNumChars*
| length of the left&hyphen;hand substring
| *other*
| string or character sequence to compare or use
|===


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