diff options
author | Timothy Flynn <trflynn89@pm.me> | 2023-02-16 11:45:07 -0500 |
---|---|---|
committer | Tim Flynn <trflynn89@pm.me> | 2023-02-17 09:14:23 -0500 |
commit | 153b7936381916aef185686d84e255380bb80f1d (patch) | |
tree | 32c2c654396aed471873d17f367bd78189c24f52 | |
parent | 4d10911f96eb6ad55a9798b7237a60407f645e91 (diff) | |
download | serenity-153b7936381916aef185686d84e255380bb80f1d.zip |
LibJS: Add a throwable StringBuilder::join method
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/ThrowableStringBuilder.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/ThrowableStringBuilder.h b/Userland/Libraries/LibJS/Runtime/ThrowableStringBuilder.h index bbee3e3cbe..452d0ff0b4 100644 --- a/Userland/Libraries/LibJS/Runtime/ThrowableStringBuilder.h +++ b/Userland/Libraries/LibJS/Runtime/ThrowableStringBuilder.h @@ -34,6 +34,13 @@ public: return {}; } + template<class SeparatorType, class CollectionType> + ThrowCompletionOr<void> join(SeparatorType const& separator, CollectionType const& collection, StringView fmtstr = "{}"sv) + { + TRY_OR_THROW_OOM(m_vm, try_join(separator, collection, fmtstr)); + return {}; + } + using AK::StringBuilder::is_empty; using AK::StringBuilder::string_view; using AK::StringBuilder::trim; |