mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
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.
This commit is contained in:
@@ -190,6 +190,10 @@ public:
|
||||
Optional<T> to_int() const;
|
||||
template<typename T = unsigned>
|
||||
Optional<T> to_uint() const;
|
||||
#ifndef KERNEL
|
||||
Optional<double> to_double(TrimWhitespace trim_whitespace = TrimWhitespace::Yes) const;
|
||||
Optional<float> to_float(TrimWhitespace trim_whitespace = TrimWhitespace::Yes) const;
|
||||
#endif
|
||||
|
||||
// Create a new substring view of this string view, starting either at the beginning of
|
||||
// the given substring view, or after its end, and continuing until the end of this string
|
||||
|
||||
Reference in New Issue
Block a user