[#bsl-basic_string-0faf-compare-07] = xref:bsl.adoc[bsl]::xref:bsl/basic_string-0faf.adoc[basic_string]::compare :relfileprefix: ../../ :mrdocs: Lexicographically compare this string with another sequence. == Synopsis Declared in `<bslstl_string.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- int compare( xref:bsl/basic_string-0faf/size_type.adoc[size_type] lhsPosition, xref:bsl/basic_string-0faf/size_type.adoc[size_type] lhsNumChars, CHAR_TYPE const* other, xref:bsl/basic_string-0faf/size_type.adoc[size_type] otherNumChars) const; ---- == Return Value negative, zero, or positive according to the lexicographic order == Parameters [cols="1,4"] |=== | Name| Description | *lhsPosition* | starting index of the left‐hand substring | *lhsNumChars* | length of the left‐hand substring | *other* | string or character sequence to compare or use | *otherNumChars* | length of the other substring |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#