Returns a view into the input string str with the given suffix removed, but leaving the original string intact. If the suffix does not match at the end of the string, returns the original string instead.
Declared in <absl/strings/strip.h>
[[nodiscard]]
constexpr
std::string_view
StripSuffix(
std::string_view str,
std::string_view suffix);
A view of str with suffix removed, or str unchanged if absent.
The return value should not be discarded.
| Name | Description |
|---|---|
| str | The input string. |
| suffix | The suffix to remove. |