| 142 | } |
| 143 | |
| 144 | int StringPiece::find_first_not_of(StringPiece s, size_type pos) const { |
| 145 | if (length_ <= 0) return npos; |
| 146 | if (s.length_ <= 0) return 0; |
| 147 | // Avoid the cost of BuildLookupTable() for a single-character search. |
| 148 | if (s.length_ == 1) return find_first_not_of(s.ptr_[0], pos); |
| 149 | |
| 150 | bool lookup[UCHAR_MAX + 1] = { false }; |
| 151 | BuildLookupTable(s, lookup); |
| 152 | for (int i = pos; i < length_; ++i) { |
| 153 | if (!lookup[static_cast<unsigned char>(ptr_[i])]) { |
| 154 | return i; |
| 155 | } |
| 156 | } |
| 157 | return npos; |
| 158 | } |
| 159 | |
| 160 | int StringPiece::find_first_not_of(char c, size_type pos) const { |
| 161 | if (length_ <= 0) return npos; |
no test coverage detected