fix(baseN): isValid(): rewrited on string_view

This commit is contained in:
2024-09-13 13:40:57 +03:00
parent 97e714fba0
commit 4bba05f991

View File

@ -8,14 +8,13 @@ namespace baseN
{ {
bool isValid(const char *str, const int8_t *map) noexcept bool isValid(const char *str, const int8_t *map) noexcept
{ {
uint64_t i = 0; std::string_view sv(str);
while (str[i] != '\0') for (size_t i = 0; i < sv.size(); i++)
{ {
if (map[(int8_t)str[i]] == -1) if (map[(int8_t)str[i]] == -1)
{ {
return false; return false;
} }
i++;
} }
return true; return true;
} }