diff options
author | davidot <davidot@serenityos.org> | 2022-10-11 00:48:45 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-10-23 15:48:45 +0200 |
commit | 6fd8e96d537e8175f0ca06789a6a19913f561455 (patch) | |
tree | 9a26604021db8e7133f9ad99874c6b4e01bd4e50 /AK/FlyString.h | |
parent | 2334cd85a26f6244c7af198f118a6d7e9c437b44 (diff) | |
download | serenity-6fd8e96d537e8175f0ca06789a6a19913f561455.zip |
AK: Add to_{double, float} convenience functions to all string types
These are guarded with #ifndef KERNEL, since doubles (and floats) are
not allowed in KERNEL mode.
In StringUtils there is convert_to_floating_point which does have a
template parameter incase you have a templated type.
Diffstat (limited to 'AK/FlyString.h')
-rw-r--r-- | AK/FlyString.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/AK/FlyString.h b/AK/FlyString.h index c81eb65e48..3cc12db868 100644 --- a/AK/FlyString.h +++ b/AK/FlyString.h @@ -77,6 +77,10 @@ public: Optional<T> to_int(TrimWhitespace = TrimWhitespace::Yes) const; template<typename T = unsigned> Optional<T> to_uint(TrimWhitespace = TrimWhitespace::Yes) const; +#ifndef KERNEL + Optional<double> to_double(TrimWhitespace = TrimWhitespace::Yes) const; + Optional<float> to_float(TrimWhitespace = TrimWhitespace::Yes) const; +#endif bool equals_ignoring_case(StringView) const; bool starts_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const; |