BAN: Add Front() and Back() to StringView
This commit is contained in:
parent
e307db47eb
commit
5122d27f89
|
@ -104,6 +104,18 @@ namespace BAN
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char StringView::Back() const
|
||||||
|
{
|
||||||
|
ASSERT(m_size > 0);
|
||||||
|
return m_data[m_size - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
char StringView::Front() const
|
||||||
|
{
|
||||||
|
ASSERT(m_size > 0);
|
||||||
|
return m_data[0];
|
||||||
|
}
|
||||||
|
|
||||||
StringView::size_type StringView::Count(char ch) const
|
StringView::size_type StringView::Count(char ch) const
|
||||||
{
|
{
|
||||||
size_type result = 0;
|
size_type result = 0;
|
||||||
|
|
|
@ -27,6 +27,9 @@ namespace BAN
|
||||||
[[nodiscard]] ErrorOr<Vector<StringView>> Split(char, bool = false);
|
[[nodiscard]] ErrorOr<Vector<StringView>> Split(char, bool = false);
|
||||||
[[nodiscard]] ErrorOr<Vector<StringView>> Split(bool(*comp)(char), bool = false);
|
[[nodiscard]] ErrorOr<Vector<StringView>> Split(bool(*comp)(char), bool = false);
|
||||||
|
|
||||||
|
char Back() const;
|
||||||
|
char Front() const;
|
||||||
|
|
||||||
size_type Count(char) const;
|
size_type Count(char) const;
|
||||||
|
|
||||||
bool Empty() const;
|
bool Empty() const;
|
||||||
|
|
Loading…
Reference in New Issue