diff --git a/BAN/BAN/StringView.cpp b/BAN/BAN/StringView.cpp index 54fd1f9dc1..33565bd379 100644 --- a/BAN/BAN/StringView.cpp +++ b/BAN/BAN/StringView.cpp @@ -145,6 +145,14 @@ namespace BAN return m_data[0]; } + bool StringView::contains(char ch) const + { + for (size_type i = 0; i < m_size; i++) + if (m_data[i] == ch) + return true; + return false; + } + StringView::size_type StringView::count(char ch) const { size_type result = 0; diff --git a/BAN/include/BAN/StringView.h b/BAN/include/BAN/StringView.h index 651fb85732..d7d275f7dd 100644 --- a/BAN/include/BAN/StringView.h +++ b/BAN/include/BAN/StringView.h @@ -35,6 +35,7 @@ namespace BAN char back() const; char front() const; + bool contains(char) const; size_type count(char) const; bool empty() const;