diff --git a/src/util/StringView.hxx b/src/util/StringView.hxx index 5be9de3ed..aea2423ec 100644 --- a/src/util/StringView.hxx +++ b/src/util/StringView.hxx @@ -88,6 +88,19 @@ struct BasicStringView : ConstBuffer { using ConstBuffer::pop_back; using ConstBuffer::skip_front; + constexpr BasicStringView substr(size_type pos, + size_type count) const noexcept { + return {data + pos, count}; + } + + constexpr BasicStringView substr(size_type pos) const noexcept { + return {data + pos, size - pos}; + } + + constexpr BasicStringView substr(const char *start) const noexcept { + return {start, size_t(data + size - start)}; + } + gcc_pure pointer Find(value_type ch) const noexcept { return StringFind(data, ch, this->size);