diff --git a/libluna/src/StringView.cpp b/libluna/src/StringView.cpp index c8209675..00dbdb32 100644 --- a/libluna/src/StringView.cpp +++ b/libluna/src/StringView.cpp @@ -50,12 +50,14 @@ const char& StringView::operator[](usize index) const bool StringView::operator==(const char* other) const { - return !strcmp(m_string, other); + if (m_length != strlen(other)) return false; + return !strncmp(m_string, other, m_length); } bool StringView::operator==(StringView other) const { - return !strcmp(m_string, other.m_string); + if (m_length != other.m_length) return false; + return !strncmp(m_string, other.m_string, m_length); } Result> StringView::split(StringView delim) const