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

Method find_first_not_of

base/string/string_piece.cpp:184–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182}
183
184size_type StringPiece::find_first_not_of(const StringPiece& s,
185 size_type pos) const {
186 if (m_length == 0)
187 return npos;
188
189 if (s.m_length == 0)
190 return 0;
191
192 // Avoid the cost of BuildLookupTable() for a single-character search.
193 if (s.m_length == 1)
194 return find_first_not_of(s.m_ptr[0], pos);
195
196 bool lookup[UCHAR_MAX + 1] = { false };
197 BuildLookupTable(s, lookup);
198 for (size_type i = pos; i < m_length; ++i) {
199 if (!lookup[static_cast<unsigned char>(m_ptr[i])]) {
200 return i;
201 }
202 }
203 return npos;
204}
205
206size_type StringPiece::find_first_not_of(char c, size_type pos) const {
207 if (m_length == 0)

Callers 4

StringTrimLeftFunction · 0.80
DoStringTrimFunction · 0.80
TESTFunction · 0.80

Calls 1

BuildLookupTableFunction · 0.85

Tested by 1

TESTFunction · 0.64