Small fix

This commit is contained in:
Federico Cecchetto 2022-06-18 21:16:37 +02:00
parent 025a814a6b
commit 25aac40a4f

View File

@ -207,21 +207,23 @@ namespace utils::string
bool strstr_lower(const char* a, const char* b) bool strstr_lower(const char* a, const char* b)
{ {
size_t index{}; const char* a_ = a;
while (*a != '\0' && b[index] != '\0') const char* b_ = b;
while (*a_ != '\0' && *b_ != '\0')
{ {
if (std::tolower(*a) == std::tolower(b[index])) if (std::tolower(*a_) == std::tolower(*b_))
{ {
index++; b_++;
} }
else if (index != 0) else
{ {
return false; b_ = b;
} }
a++; a_++;
} }
return b[index] == '\0'; return *b_ == '\0';
} }
} }