| 216 | } |
| 217 | |
| 218 | StringPiece StringPiece::substr(size_type pos, size_type n) const { |
| 219 | if (pos > length_) pos = length_; |
| 220 | if (n > length_ - pos) n = length_ - pos; |
| 221 | return StringPiece(ptr_ + pos, n); |
| 222 | } |
| 223 | |
| 224 | const StringPiece::size_type StringPiece::npos = size_type(-1); |