summaryrefslogtreecommitdiff
path: root/AK/String.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-10-19 20:50:55 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-10-19 20:54:47 +0200
commit96f9e6a64fdc04aa852f1cd8368feaf736712f27 (patch)
treea532d1a19f2f6ba42763cd7eafb9c32021bf8dc8 /AK/String.cpp
parentfbdd0def47626e36a59c579984fbcf038009122b (diff)
downloadserenity-96f9e6a64fdc04aa852f1cd8368feaf736712f27.zip
String: Define operator>(String)
Diffstat (limited to 'AK/String.cpp')
-rw-r--r--AK/String.cpp11
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();