AK: Add String to number floating point support

This commit is contained in:
Bastiaan van der Plaat 2023-10-27 18:27:54 +02:00 committed by Sam Atkins
parent 2361ce25a0
commit 4a7d3115c9
Notes: sideshowbarker 2024-07-17 03:03:15 +09:00

View file

@ -181,6 +181,10 @@ public:
template<Arithmetic T>
Optional<T> to_number(TrimWhitespace trim_whitespace = TrimWhitespace::Yes) const
{
#ifndef KERNEL
if constexpr (IsFloatingPoint<T>)
return StringUtils::convert_to_floating_point<T>(bytes_as_string_view(), trim_whitespace);
#endif
if constexpr (IsSigned<T>)
return StringUtils::convert_to_int<T>(bytes_as_string_view(), trim_whitespace);
else