From 4a7d3115c9697339cfe39878dd9d708d681afa75 Mon Sep 17 00:00:00 2001 From: Bastiaan van der Plaat Date: Fri, 27 Oct 2023 18:27:54 +0200 Subject: [PATCH] AK: Add String to number floating point support --- AK/String.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/AK/String.h b/AK/String.h index 42b7a8d58ff..a8471ee4e54 100644 --- a/AK/String.h +++ b/AK/String.h @@ -181,6 +181,10 @@ public: template Optional to_number(TrimWhitespace trim_whitespace = TrimWhitespace::Yes) const { +#ifndef KERNEL + if constexpr (IsFloatingPoint) + return StringUtils::convert_to_floating_point(bytes_as_string_view(), trim_whitespace); +#endif if constexpr (IsSigned) return StringUtils::convert_to_int(bytes_as_string_view(), trim_whitespace); else