|
@@ -4,6 +4,7 @@
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
*/
|
|
|
|
|
|
+#include <AK/CharacterTypes.h>
|
|
|
#include <AK/StringBuilder.h>
|
|
|
#include <AK/StringView.h>
|
|
|
#include <AK/Utf16View.h>
|
|
@@ -214,6 +215,22 @@ bool Utf16View::operator==(Utf16View const& other) const
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+bool Utf16View::equals_ignoring_case(Utf16View const& other) const
|
|
|
+{
|
|
|
+ if (length_in_code_units() == 0)
|
|
|
+ return other.length_in_code_units() == 0;
|
|
|
+ if (length_in_code_units() != other.length_in_code_units())
|
|
|
+ return false;
|
|
|
+
|
|
|
+ for (size_t i = 0; i < length_in_code_units(); ++i) {
|
|
|
+ // FIXME: Handle non-ASCII case insensitive comparisons.
|
|
|
+ if (to_ascii_lowercase(m_code_units[i]) != to_ascii_lowercase(other.m_code_units[i]))
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
Utf16CodePointIterator& Utf16CodePointIterator::operator++()
|
|
|
{
|
|
|
size_t code_units = length_in_code_units();
|