AK: Add StringView::substring_view(size_t) overload.
This commit is contained in:
parent
b7bd2ed9d2
commit
d831b5738d
Notes:
sideshowbarker
2024-07-19 02:17:38 +09:00
Author: https://github.com/asynts Commit: https://github.com/SerenityOS/serenity/commit/d831b5738d9 Pull-request: https://github.com/SerenityOS/serenity/pull/3536
2 changed files with 6 additions and 0 deletions
|
@ -193,6 +193,11 @@ StringView StringView::substring_view(size_t start, size_t length) const
|
|||
ASSERT(start + length <= m_length);
|
||||
return { m_characters + start, length };
|
||||
}
|
||||
StringView StringView::substring_view(size_t start) const
|
||||
{
|
||||
ASSERT(start <= m_length);
|
||||
return { m_characters + start, length() - start };
|
||||
}
|
||||
|
||||
StringView StringView::substring_view_starting_from_substring(const StringView& substring) const
|
||||
{
|
||||
|
|
|
@ -98,6 +98,7 @@ public:
|
|||
Optional<size_t> find_last_of(const StringView&) const;
|
||||
|
||||
StringView substring_view(size_t start, size_t length) const;
|
||||
StringView substring_view(size_t start) const;
|
||||
Vector<StringView> split_view(char, bool keep_empty = false) const;
|
||||
Vector<StringView> split_view(const StringView&, bool keep_empty = false) const;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue