diff --git a/GeoModelTools/GeoModelFuncSnippets/src/StringUtils.cxx b/GeoModelTools/GeoModelFuncSnippets/src/StringUtils.cxx index 89b7a0cd649389441f692c972552fe6e9f987ab4..c17fb500cdc2a0b85203ce32d64980eb9ce35c8c 100644 --- a/GeoModelTools/GeoModelFuncSnippets/src/StringUtils.cxx +++ b/GeoModelTools/GeoModelFuncSnippets/src/StringUtils.cxx @@ -120,9 +120,10 @@ namespace GeoStrUtils { convertToNumber(str.substr(1), number); return; } - if (std::from_chars(str.data(), str.data() + str.size(), number).ec != std::errc{}) { - THROW_EXCEPTION("convertToNumber() - The string '"<<str<<"'. Contains unallowed chars"); - } + std::istringstream stream(std::string(str.data(), str.data()+str.size())); + stream >> number; + if (!stream) THROW_EXCEPTION("convertToNumber() - The string '"<<str<<"'. Contains unallowed chars"); + } int atoi(std::string_view str) { int result{std::numeric_limits<int>::max()}; @@ -135,4 +136,4 @@ namespace GeoStrUtils { convertToNumber(str, result); return result; } -} \ No newline at end of file +}