Remove parse_number

This commit is contained in:
Igor Pissolati
2026-01-05 09:00:45 -03:00
parent d51f890197
commit 5d59700ec7
2 changed files with 1 additions and 20 deletions

View File

@@ -181,23 +181,4 @@ namespace utils::string
{
return std::ranges::equal(lhs, rhs, [](const auto c1, const auto c2) { return char_to_lower(c1) == char_to_lower(c2); });
}
template <typename Integer, class Elem, class Traits>
requires(std::is_integral_v<Integer>)
Integer parse_number(const std::basic_string_view<Elem, Traits> str)
{
Integer result = 0;
for (const auto ch : str)
{
if (ch < u'0' || ch > u'9')
{
break;
}
result = result * 10 + static_cast<Integer>(ch - u'0');
}
return result;
}
}

View File

@@ -196,7 +196,7 @@ namespace
if (value->name == "CurrentBuildNumber" || value->name == "CurrentBuild")
{
const auto* s = reinterpret_cast<const char16_t*>(value->data.data());
return utils::string::parse_number<uint32_t>(std::u16string_view(s));
return static_cast<uint32_t>(std::strtoul(u16_to_u8(s).c_str(), nullptr, 10));
}
}