Lexicographically compare this string with another sequence.

Synopses

Declared in <bslstl_string.h>

Lexicographically compare this string with another sequence.

int
compare(basic_string const& other) const noexcept;

Lexicographically compare this string with another sequence.

int
compare(CHAR_TYPE const* other) const;

Lexicographically compare this string with another sequence.

template<class STRING_VIEW_LIKE_TYPE>
int
compare(STRING_VIEW_LIKE_TYPE const& other) const noexcept(true);

Lexicographically compare this string with another sequence.

int
compare(
    size_type lhsPosition,
    size_type lhsNumChars,
    CHAR_TYPE const* other) const;

Lexicographically compare this string with another sequence.

int
compare(
    size_type position,
    size_type numChars,
    basic_string const& other) const;

Lexicographically compare this string with another sequence.

template<class STRING_VIEW_LIKE_TYPE>
int
compare(
    size_type position,
    size_type numChars,
    STRING_VIEW_LIKE_TYPE const& other) const;

Lexicographically compare this string with another sequence.

int
compare(
    size_type lhsPosition,
    size_type lhsNumChars,
    CHAR_TYPE const* other,
    size_type otherNumChars) const;

Lexicographically compare this string with another sequence.

int
compare(
    size_type lhsPosition,
    size_type lhsNumChars,
    basic_string const& other,
    size_type otherPosition,
    size_type otherNumChars = npos) const;

Lexicographically compare this string with another sequence.

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

Name

Description

other

string or character sequence to compare or use

lhsPosition

starting index of the left‐hand substring

lhsNumChars

length of the left‐hand substring

position

starting index

numChars

number of characters

otherNumChars

length of the other substring

otherPosition

starting index in the other string

Created with MrDocs