diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2023-02-14 14:37:39 +0000 |
---|---|---|
committer | Tim Flynn <trflynn89@pm.me> | 2023-02-15 12:48:26 -0500 |
commit | 1453ac79e79dcce39066ba511f4a1d3ef10f39ed (patch) | |
tree | 711e85c43cd8403615ea3c861833b89ab9426699 | |
parent | a35fa553dde8f18067f52b94077c20d5b9c889e1 (diff) | |
download | serenity-1453ac79e79dcce39066ba511f4a1d3ef10f39ed.zip |
AK: Add StringBuilder::to_fly_string()
-rw-r--r-- | AK/StringBuilder.cpp | 6 | ||||
-rw-r--r-- | AK/StringBuilder.h | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/AK/StringBuilder.cpp b/AK/StringBuilder.cpp index 1754a4709b..8999592f1a 100644 --- a/AK/StringBuilder.cpp +++ b/AK/StringBuilder.cpp @@ -15,6 +15,7 @@ #ifndef KERNEL # include <AK/DeprecatedString.h> +# include <AK/FlyString.h> # include <AK/Utf16View.h> #endif @@ -122,6 +123,11 @@ ErrorOr<String> StringBuilder::to_string() const { return String::from_utf8(string_view()); } + +ErrorOr<FlyString> StringBuilder::to_fly_string() const +{ + return FlyString::from_utf8(string_view()); +} #endif StringView StringBuilder::string_view() const diff --git a/AK/StringBuilder.h b/AK/StringBuilder.h index 7342426be5..0d8a8c311f 100644 --- a/AK/StringBuilder.h +++ b/AK/StringBuilder.h @@ -66,6 +66,7 @@ public: #endif ErrorOr<String> to_string() const; + ErrorOr<FlyString> to_fly_string() const; [[nodiscard]] ByteBuffer to_byte_buffer() const; |