Finds the last occurrence of needle in haystack. The result is the offset reported to the beginning of haystack, or string::npos if needle wasn't found.

Synopses

Declared in <folly/Range.h>

Finds the last occurrence of needle in haystack. The result is the offset reported to the beginning of haystack, or string::npos if needle wasn't found.

template<class Iter>
size_t
rfind(
    Range<Iter> const& haystack,
    Range<Iter>::value_type const& needle);
template<>
size_t
rfind<char const*>(
    Range<char const*> const& haystack,
    char const& needle);
template<>
size_t
rfind<unsigned char const*>(
    Range<unsigned char const*> const& haystack,
    unsigned char const& needle);

Return Value

The offset of the last match, or npos if not found.

Parameters

Name

Description

haystack

The range to search within.

needle

The element to search for.

Created with MrDocs