BAN: Fix StringView::starts_with

I have no idea what i had been thinking when writing this code :D
This commit is contained in:
Bananymous 2024-10-06 06:23:25 +03:00
parent 4f3c05851c
commit 6f90974896
1 changed files with 4 additions and 9 deletions

View File

@ -186,15 +186,10 @@ namespace BAN
{ {
if (target.size() > m_size) if (target.size() > m_size)
return false; return false;
for (size_type i = 0; i < m_size - target.size(); i++) for (size_type i = 0; i < target.size(); i++)
{ if (m_data[i] != target[i])
bool valid = true; return false;
for (size_type j = 0; j < target.size() && valid; j++) return true;
valid = (m_data[i + j] == target[j]);
if (valid)
return true;
}
return false;
} }
constexpr bool contains(char ch) const constexpr bool contains(char ch) const