| 185 | } |
| 186 | |
| 187 | int StringPiece::find_last_not_of(StringPiece s, size_type pos) const { |
| 188 | if (length_ <= 0) return npos; |
| 189 | |
| 190 | int i = min(pos, static_cast<size_type>(length_ - 1)); |
| 191 | if (s.length_ <= 0) return i; |
| 192 | |
| 193 | // Avoid the cost of BuildLookupTable() for a single-character search. |
| 194 | if (s.length_ == 1) return find_last_not_of(s.ptr_[0], pos); |
| 195 | |
| 196 | bool lookup[UCHAR_MAX + 1] = { false }; |
| 197 | BuildLookupTable(s, lookup); |
| 198 | for (; i >= 0; --i) { |
| 199 | if (!lookup[static_cast<unsigned char>(ptr_[i])]) { |
| 200 | return i; |
| 201 | } |
| 202 | } |
| 203 | return npos; |
| 204 | } |
| 205 | |
| 206 | int StringPiece::find_last_not_of(char c, size_type pos) const { |
| 207 | if (length_ <= 0) return npos; |
nothing calls this directly
no test coverage detected