From 159eda5c6d3c3555299773b92f4196d974c7a0e2 Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Sat, 23 Dec 2023 11:55:22 +1300 Subject: [PATCH] AK: Add ByteString::to_number To mirror the API with StringView and String. --- AK/ByteString.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/AK/ByteString.h b/AK/ByteString.h index f10732fc0ba..f8967f2aecf 100644 --- a/AK/ByteString.h +++ b/AK/ByteString.h @@ -119,6 +119,12 @@ public: [[nodiscard]] Optional to_float(TrimWhitespace = TrimWhitespace::Yes) const; #endif + template + Optional to_number(TrimWhitespace trim_whitespace = TrimWhitespace::Yes) const + { + return view().to_number(trim_whitespace); + } + [[nodiscard]] ByteString to_lowercase() const; [[nodiscard]] ByteString to_uppercase() const; [[nodiscard]] ByteString to_snakecase() const;