string::starts_with

## `string::starts_with`

Return whether the string begins with another string.

### Synopsis

    bool
    starts_with(
        string_view s) const noexcept; (1)

    bool
    starts_with(
        char ch) const noexcept; (2)

### Description

- (1) checks if the string begins with `s`.

- (2) checks if the string begins with `ch`.

### Complexity

- (1) linear in `s.size()`.

- (2) constant.

### Parameters

Name | Description
--- | ---
`s` | The string to check for.
`ch` | The character to check for.

Edit this page