MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenImageIO / rfind

Function rfind

src/include/string_ref.h:220–227  ·  view source on GitHub ↗

Find the last occurrence of substring s *this, but only those occurrences earlier than position pos.

Source from the content-addressed store, hash-verified

218 /// Find the last occurrence of substring s *this, but only those
219 /// occurrences earlier than position pos.
220 size_type rfind (string_ref s, size_t pos=npos) const {
221 if (pos > size())
222 pos = size();
223 const_reverse_iterator b = this->crbegin()+(size()-pos);
224 const_reverse_iterator e = this->crend();
225 const_reverse_iterator i = std::search (b, e, s.crbegin(), s.crend(), traits::eq);
226 return i == e ? npos : (reverse_distance(this->crbegin(),i) - s.size() + 1);
227 }
228
229 /// Find the last occurrence of character c in *this, but only those
230 /// occurrences earlier than position pos.

Callers 3

ustring.hFile · 0.70
pystring.hFile · 0.70
find_last_ofFunction · 0.70

Calls 6

reverse_distanceFunction · 0.85
traits_eqClass · 0.85
crbeginMethod · 0.80
crendMethod · 0.80
sizeFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected