fix(baseN): isValid(): rewrited on string_view
This commit is contained in:
@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user