Does "this" end with "x"?
| 154 | |
| 155 | // Does "this" end with "x"? |
| 156 | bool ends_with(const StringPiece& x) const { |
| 157 | return x.empty() || |
| 158 | (size() >= x.size() && |
| 159 | memcmp(data() + (size() - x.size()), x.data(), x.size()) == 0); |
| 160 | } |
| 161 | |
| 162 | bool contains(const StringPiece& s) const { |
| 163 | return find(s) != npos; |