From da6d18beef60f1c0ae1fe5f8266501f1bf7e9ed0 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 20 Nov 2021 20:52:23 +0100 Subject: [PATCH] String.find() now correctly finds equality aswell. --- core/string.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/string.cpp b/core/string.cpp index dc42760..3a9ea0e 100644 --- a/core/string.cpp +++ b/core/string.cpp @@ -127,7 +127,7 @@ int String::find(const char val, const int from) const { } int String::find(const String &val, const int from) const { - int ve = _size - val.size(); + int ve = _size - val.size() + 1; for (int i = from; i < ve; ++i) { bool found = true; @@ -142,7 +142,7 @@ int String::find(const String &val, const int from) const { return i; } } - + return -1; }