Core/StringExt: Fix IsNumber returning true for "-"

This commit is contained in:
SirLynix
2024-01-26 10:11:07 +01:00
parent d3fabf21d6
commit 63c61c0827
2 changed files with 5 additions and 3 deletions

View File

@@ -26,12 +26,12 @@ namespace Nz
inline bool IsNumber(std::string_view str)
{
if (!str.empty() && str.front() == '-')
str.remove_prefix(1);
if (str.empty())
return false;
if (str.front() == '-')
str.remove_prefix(1);
return std::find_if(str.begin(), str.end(), [](unsigned char c) { return !std::isdigit(c); }) == str.end();
}