MCPcopy Create free account
hub / github.com/apache/impala / find_last_of

Method find_last_of

be/src/gutil/strings/stringpiece.cc:171–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169}
170
171int StringPiece::find_last_of(StringPiece s, size_type pos) const {
172 if (length_ <= 0 || s.length_ <= 0) return npos;
173 // Avoid the cost of BuildLookupTable() for a single-character search.
174 if (s.length_ == 1) return find_last_of(s.ptr_[0], pos);
175
176 bool lookup[UCHAR_MAX + 1] = { false };
177 BuildLookupTable(s, lookup);
178 for (int i = min(pos, static_cast<size_type>(length_ - 1));
179 i >= 0; --i) {
180 if (lookup[static_cast<unsigned char>(ptr_[i])]) {
181 return i;
182 }
183 }
184 return npos;
185}
186
187int StringPiece::find_last_not_of(StringPiece s, size_type pos) const {
188 if (length_ <= 0) return npos;

Callers 4

ReverseFindNthFunction · 0.45
ParsePoolTopicKeyFunction · 0.45
DemangleNameOnlyMethod · 0.45

Calls 2

BuildLookupTableFunction · 0.85
minFunction · 0.85

Tested by

no test coverage detected