string::ends_with

Check if the string ends with given suffix.

Synopsis

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

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

Description

  • (1) returns true if the string ends with s.

  • (2) returns true if the string ends with the character ch.

Complexity

  • (1) linear in s.

  • (2) constant.

Exception Safety

No-throw guarantee.

Parameters

Name Description

s

The string to check for.

ch

The character to check for.