MCPcopy Create free account
hub / github.com/chen3feng/toft / rfind

Method rfind

base/string/string_piece.cpp:123–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121}
122
123size_type StringPiece::rfind(const StringPiece& s, size_type pos) const {
124 if (m_length < s.m_length)
125 return npos;
126
127 if (s.empty())
128 return std::min(m_length, pos);
129
130 const char* last = m_ptr + std::min(m_length - s.m_length, pos) + s.m_length;
131 const char* result = std::find_end(m_ptr, last, s.m_ptr, s.m_ptr + s.m_length);
132 return result != last ? static_cast<size_t>(result - m_ptr) : npos;
133}
134
135size_type StringPiece::rfind(char c, size_type pos) const {
136 if (m_length == 0)

Callers 4

GetBaseNameMethod · 0.80
GetExtensionMethod · 0.80
GetDirectoryMethod · 0.80
TESTFunction · 0.80

Calls 1

emptyMethod · 0.45

Tested by 1

TESTFunction · 0.64