LeechCraft 0.6.70-19424-g027e980fd1
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
util.cpp
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#include "util.h"
10#include <QString>
11
12namespace LC::Util
13{
15 {
16 return QStringLiteral ("; ");
17 }
18
19 QString GetTagsDelimiter (const QString& separator)
20 {
21 const auto& trimmed = separator.trimmed ();
22 return trimmed.isEmpty () ? separator : trimmed;
23 }
24
25 QStringList SplitTags (QStringView text, const QString& separator)
26 {
27 QStringList result;
28 for (const auto& part : text.split (GetTagsDelimiter (separator), Qt::SkipEmptyParts))
29 if (auto tag = part.trimmed (); !tag.isEmpty ())
30 result << tag.toString ();
31 return result;
32 }
33
34}
QStringList SplitTags(QStringView text, const QString &separator)
Splits a string with tags into the tags.
Definition util.cpp:25
QString GetDefaultTagsSeparator()
Definition util.cpp:14
QString GetTagsDelimiter(const QString &separator)
Returns the delimiter the tags are split by for the given separator they are joined with.
Definition util.cpp:19