AK: Add String::join() helper function
This is a simple wrapper around StringBuilder::join().
This commit is contained in:
parent
e83799dc02
commit
7ad9b116f7
Notes:
sideshowbarker
2024-07-18 23:47:49 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/7ad9b116f7a Pull-request: https://github.com/SerenityOS/serenity/pull/4963
1 changed files with 10 additions and 0 deletions
10
AK/String.h
10
AK/String.h
|
@ -30,6 +30,7 @@
|
|||
#include <AK/Forward.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/Stream.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/StringImpl.h>
|
||||
#include <AK/StringUtils.h>
|
||||
#include <AK/Traits.h>
|
||||
|
@ -111,6 +112,15 @@ public:
|
|||
String(const FlyString&);
|
||||
|
||||
static String repeated(char, size_t count);
|
||||
|
||||
template<class SeparatorType, class CollectionType>
|
||||
static String join(const SeparatorType& separator, const CollectionType& collection)
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.join(separator, collection);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
bool matches(const StringView& mask, CaseSensitivity = CaseSensitivity::CaseInsensitive) const;
|
||||
bool matches(const StringView& mask, Vector<MaskSpan>&, CaseSensitivity = CaseSensitivity::CaseInsensitive) const;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue