mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:07:46 +00:00
AK: Add StringView::contains(char)
This commit is contained in:
parent
1f6578ee0a
commit
b77ceecb02
2 changed files with 11 additions and 1 deletions
|
@ -25,10 +25,10 @@
|
|||
*/
|
||||
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/FlyString.h>
|
||||
#include <AK/Memory.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <AK/FlyString.h>
|
||||
#include <AK/Vector.h>
|
||||
|
||||
namespace AK {
|
||||
|
@ -157,6 +157,15 @@ bool StringView::matches(const StringView& mask, CaseSensitivity case_sensitivit
|
|||
return StringUtils::matches(*this, mask, case_sensitivity);
|
||||
}
|
||||
|
||||
bool StringView::contains(char needle) const
|
||||
{
|
||||
for (char current : *this) {
|
||||
if (current == needle)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
StringView StringView::substring_view(size_t start, size_t length) const
|
||||
{
|
||||
ASSERT(start + length <= m_length);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue