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

Method find_last_of

base/string/string_piece.cpp:218–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

216}
217
218size_type StringPiece::find_last_of(const StringPiece& s, size_type pos) const {
219 if (m_length == 0 || s.m_length == 0)
220 return npos;
221
222 // Avoid the cost of BuildLookupTable() for a single-character search.
223 if (s.m_length == 1)
224 return find_last_of(s.m_ptr[0], pos);
225
226 bool lookup[UCHAR_MAX + 1] = { false };
227 BuildLookupTable(s, lookup);
228 for (size_type i = std::min(pos, m_length - 1); ; --i) {
229 if (lookup[static_cast<unsigned char>(m_ptr[i])])
230 return i;
231 if (i == 0)
232 break;
233 }
234 return npos;
235}
236
237size_type StringPiece::find_last_not_of(const StringPiece& s,
238 size_type pos) const {

Callers 3

TESTFunction · 0.45
merge_pathFunction · 0.45

Calls 1

BuildLookupTableFunction · 0.85

Tested by 1

TESTFunction · 0.36