| 28 | } |
| 29 | |
| 30 | bool TryStripPrefixString(StringPiece str, const StringPiece& prefix, |
| 31 | string* result) { |
| 32 | const bool has_prefix = str.starts_with(prefix); |
| 33 | if (has_prefix) |
| 34 | str.remove_prefix(prefix.length()); |
| 35 | str.as_string().swap(*result); |
| 36 | return has_prefix; |
| 37 | } |
| 38 | |
| 39 | string StripSuffixString(StringPiece str, const StringPiece& suffix) { |
| 40 | if (str.ends_with(suffix)) |
no test coverage detected