bsl::basic_string::compare

Lexicographically compare this string with another sequence.

Synopsis

Declared in <bslstl_string.h>

template<class STRING_VIEW_LIKE_TYPE>
int
compare(
    size_type lhsPosition,
    size_type lhsNumChars,
    STRING_VIEW_LIKE_TYPE const& other,
    size_type otherPosition,
    size_type otherNumChars = npos) const;

Return Value

negative, zero, or positive according to the lexicographic order

Parameters

NameDescription
lhsPositionstarting index of the left-hand substring
lhsNumCharslength of the left-hand substring
otherstring or character sequence to compare or use
otherPositionstarting index in the other string
otherNumCharslength of the other substring