string::find_last_of

Find the last character present in the specified string.

Synopsis

std::size_t
find_last_of(
    string_view sv,
    std::size_t pos = string::npos) const noexcept;

Description

Search from pos backwards for the first character in this string that is equal to any of the characters of sv. If pos is equal to npos (the default), search from the last character.

Complexity

Linear in size() + sv.size().

Exception Safety

No-throw guarantee.

Return Value

The index of the found character, or npos if none exists.

Parameters

Name Description

sv

The characters to search for.

pos

The index to start searching at.