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

Method find_first_of

base/string/string_piece.cpp:165–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165size_type StringPiece::find_first_of(const StringPiece& s,
166 size_type pos) const {
167 if (m_length == 0 || s.m_length == 0)
168 return npos;
169
170 // Avoid the cost of BuildLookupTable() for a single-character search.
171 if (s.m_length == 1)
172 return find_first_of(s.m_ptr[0], pos);
173
174 bool lookup[UCHAR_MAX + 1] = { false };
175 BuildLookupTable(s, lookup);
176 for (size_type i = pos; i < m_length; ++i) {
177 if (lookup[static_cast<unsigned char>(m_ptr[i])]) {
178 return i;
179 }
180 }
181 return npos;
182}
183
184size_type StringPiece::find_first_not_of(const StringPiece& s,
185 size_type pos) const {

Callers 4

ShellIsQuoteNeedFunction · 0.45
TESTFunction · 0.45
ParseHeadersMethod · 0.45

Calls 1

BuildLookupTableFunction · 0.85

Tested by 1

TESTFunction · 0.36