string::find

## `string::find`

Find the first occurrence of characters within the string.

### Synopsis

    std::size_t
    find(
        string_view sv,
        std::size_t pos = 0) const noexcept; (1)

    std::size_t
    find(
        char ch,
        std::size_t pos = 0) const noexcept; (2)

### Description

Search from `pos` onward for the first substring that is equal to the first argument.

- (1) searches for the presense of the substring equal to `sv`.

- (2) searches for the presense of the substring consisting of the character `ch`.

### Complexity

Linear in `size()`.

### Exception Safety

No-throw guarantee.

### Return Value

The index of the first character of the found substring, or `npos` if none was found.

### Parameters

Name | Description
--- | ---
`sv` | The `string_view` to search for.
`pos` | The index to start searching at.
`ch` | The character to search for.

Edit this page