AK: Add ByteString::to_number<T>

To mirror the API with StringView and String.
This commit is contained in:
Shannon Booth 2023-12-23 11:55:22 +13:00 committed by Andreas Kling
parent cdf84a3e36
commit 159eda5c6d

View file

@ -119,6 +119,12 @@ public:
[[nodiscard]] Optional<float> to_float(TrimWhitespace = TrimWhitespace::Yes) const;
#endif
template<Arithmetic T>
Optional<T> to_number(TrimWhitespace trim_whitespace = TrimWhitespace::Yes) const
{
return view().to_number<T>(trim_whitespace);
}
[[nodiscard]] ByteString to_lowercase() const;
[[nodiscard]] ByteString to_uppercase() const;
[[nodiscard]] ByteString to_snakecase() const;