1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:47:44 +00:00

AK: Add String::substring_view(size_t).

This commit is contained in:
asynts 2020-12-01 23:11:20 +01:00 committed by Andreas Kling
parent ac2358ff0d
commit 78eff163ea
2 changed files with 8 additions and 0 deletions

View file

@ -147,6 +147,13 @@ StringView String::substring_view(size_t start, size_t length) const
return { characters() + start, length };
}
StringView String::substring_view(size_t start) const
{
ASSERT(m_impl);
ASSERT(start <= length());
return { characters() + start, length() - start };
}
Vector<String> String::split(char separator, bool keep_empty) const
{
return split_limit(separator, 0, keep_empty);