| 182 | } |
| 183 | |
| 184 | size_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 | |
| 206 | size_type StringPiece::find_first_not_of(char c, size_type pos) const { |
| 207 | if (m_length == 0) |