bsl::basic_string::rfind

Return the last occurrence of the specified substring in this string.

Synopsis

Declared in <bslstl_string.h>

size_type
rfind(
    basic_string const& substring,
    size_type position = npos) const noexcept;

Description

Return the starting position of the last occurrence of the specified substring within this string, if such a sequence can be found in this string (on or before the optionally specified position if such a position is specified) using CHAR_TRAITS::eq to compare characters, and return npos otherwise.

Return Value

position of the match, or npos if not found

Parameters

NameDescription
substringsubstring to search for
positionstarting index