string::compare

## `string::compare`

Compare a string with the string.

### Synopsis

    int
    compare(
        string_view sv) const noexcept;

### Description

Let `comp` be `std::char_traits<char>::compare(data(), sv.data(), std::min(size(), sv.size())`. If `comp != 0`, then the result is `comp`. Otherwise, the result is `0` if `size() == sv.size()`, `-1` if `size() < sv.size()`, and `1` otherwise.

### Complexity

Linear.

### Return Value

The result of lexicographically comparing the characters of `sv` and the string.

### Parameters

Name | Description
--- | ---
`sv` | The `string_view` to compare.

Edit this page