mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
AK: Add String to number floating point support
This commit is contained in:
parent
2361ce25a0
commit
4a7d3115c9
1 changed files with 4 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue