Like s.substr(pos, n), but clips pos to an upper bound of s.size().
Synopsis
Declared in <absl/strings/string_view.h>
std::string_view
ClippedSubstr(
std::string_view s,
size_t pos,
size_t n = string_view::npos);
Description
Provided because std::string_view::substr throws if pos > size().
Return Value
A view of the clipped substring.
Parameters
Name |
Description |
s |
The string view to take a substring of. |
pos |
The starting position, clipped to |
n |
The number of characters to include in the substring. |
Created with MrDocs