mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
AK: Add some string comparison operators
Some of these are very inefficient. It's nice to have some optimization opportunities in the future though. :^)
This commit is contained in:
@@ -104,4 +104,21 @@ StringView FlyString::view() const
|
||||
return { characters(), length() };
|
||||
}
|
||||
|
||||
bool FlyString::operator==(const String& string) const
|
||||
{
|
||||
if (m_impl == string.impl())
|
||||
return true;
|
||||
return String(m_impl.ptr()) == string;
|
||||
}
|
||||
|
||||
bool FlyString::operator==(const StringView& string) const
|
||||
{
|
||||
return String(string) == String(m_impl.ptr());
|
||||
}
|
||||
|
||||
bool FlyString::operator==(const char* string) const
|
||||
{
|
||||
return String(string) == String(m_impl.ptr());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user