diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-10-19 20:50:55 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-10-19 20:54:47 +0200 |
commit | 96f9e6a64fdc04aa852f1cd8368feaf736712f27 (patch) | |
tree | a532d1a19f2f6ba42763cd7eafb9c32021bf8dc8 /AK/String.cpp | |
parent | fbdd0def47626e36a59c579984fbcf038009122b (diff) | |
download | serenity-96f9e6a64fdc04aa852f1cd8368feaf736712f27.zip |
String: Define operator>(String)
Diffstat (limited to 'AK/String.cpp')
-rw-r--r-- | AK/String.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/AK/String.cpp b/AK/String.cpp index 665936af54..d20193685f 100644 --- a/AK/String.cpp +++ b/AK/String.cpp @@ -44,6 +44,17 @@ bool String::operator<(const String& other) const return strcmp(characters(), other.characters()) < 0; } +bool String::operator>(const String& other) const +{ + if (!m_impl) + return other.m_impl; + + if (!other.m_impl) + return false; + + return strcmp(characters(), other.characters()) > 0; +} + String String::empty() { return StringImpl::the_empty_stringimpl(); |