diff --git a/BAN/BAN/String.cpp b/BAN/BAN/String.cpp index cefbeb30f..296878b9c 100644 --- a/BAN/BAN/String.cpp +++ b/BAN/BAN/String.cpp @@ -141,9 +141,9 @@ namespace BAN bool String::operator==(const char* other) const { - if (m_size != strlen(other)) + if (memcmp(m_data, other, m_size)) return false; - return memcmp(m_data, other, m_size) == 0; + return other[m_size] == '\0'; } ErrorOr String::Resize(size_type size, char ch) diff --git a/BAN/BAN/StringView.cpp b/BAN/BAN/StringView.cpp index b86d78c73..2881d2e9b 100644 --- a/BAN/BAN/StringView.cpp +++ b/BAN/BAN/StringView.cpp @@ -45,9 +45,9 @@ namespace BAN bool StringView::operator==(const char* other) const { - if (m_size != strlen(other)) + if (memcmp(m_data, other, m_size)) return false; - return memcmp(m_data, other, m_size) == 0; + return other[m_size] == '\0'; } StringView StringView::Substring(size_type index, size_type len) const