Finish parsing Storm Position / Forecast page

This commit is contained in:
Dan Paulat 2024-02-21 22:47:50 -06:00
parent 0415223571
commit 925f91995a
4 changed files with 127 additions and 9 deletions

View file

@ -88,6 +88,21 @@ std::string ToString(const std::vector<std::string>& v)
return value;
}
std::optional<float> TryParseFloat(const std::string& str)
{
std::optional<float> value = std::nullopt;
try
{
value = static_cast<float>(std::stof(str));
}
catch (const std::exception&)
{
}
return value;
}
template<typename T>
std::optional<T> TryParseUnsignedLong(const std::string& str)
{