String.find() now correctly finds equality aswell.

This commit is contained in:
Relintai 2021-11-20 20:52:23 +01:00
parent 97af1dbde3
commit da6d18beef

View File

@ -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 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) { for (int i = from; i < ve; ++i) {
bool found = true; bool found = true;
@ -142,7 +142,7 @@ int String::find(const String &val, const int from) const {
return i; return i;
} }
} }
return -1; return -1;
} }