[#BloombergLP-bslstl-StringRefImp_CompareUtil-compare]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::xref:BloombergLP/bslstl/StringRefImp_CompareUtil.adoc[StringRefImp&lowbar;CompareUtil]::compare
:relfileprefix: ../../../
:mrdocs:

Lexicographically compare string object `a` with C&hyphen;string `b`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class CHAR&lowbar;TYPE&gt;
static
int
compare(
    xref:BloombergLP/bslstl/StringRefImp-0c.adoc[StringRefImp&lt;CHAR&lowbar;TYPE&gt;] const& a,
    CHAR&lowbar;TYPE const* b);
----

== Description

Compare the specified string object `a` with the specified null&hyphen;terminated C&hyphen;string `b` using a lexicographical comparison and return a negative value if `a` is less than `b`, a positive value if `a` is greater than `b`, and 0 if `a` is equal to `b`&period;

== Return Value

negative, zero, or positive comparison result

== Parameters

[cols="1,4"]
|===
| Name| Description
| *a*
| string object to compare
| *b*
| null&hyphen;terminated C&hyphen;string to compare against
|===


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