mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:34:57 +00:00
AK: Implement all comparison operators for StringView
This commit is contained in:
parent
2e5a9b4fab
commit
ca58c71faa
2 changed files with 24 additions and 23 deletions
|
@ -203,15 +203,7 @@ template Optional<long long> StringView::to_uint() const;
|
|||
|
||||
bool StringView::operator==(const String& string) const
|
||||
{
|
||||
if (string.is_null())
|
||||
return !m_characters;
|
||||
if (!m_characters)
|
||||
return false;
|
||||
if (m_length != string.length())
|
||||
return false;
|
||||
if (m_characters == string.characters())
|
||||
return true;
|
||||
return !__builtin_memcmp(m_characters, string.characters(), m_length);
|
||||
return *this == string.view();
|
||||
}
|
||||
|
||||
String StringView::to_string() const { return String { *this }; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue