mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-18 06:28:03 -06:00
Refactor out helper function Utils::String::unquote
Remove redundant include
This commit is contained in:
committed by
sledgehammer999
parent
c9500d933b
commit
83dd0ae86e
@@ -30,10 +30,10 @@
|
|||||||
#ifndef UTILS_STRING_H
|
#ifndef UTILS_STRING_H
|
||||||
#define UTILS_STRING_H
|
#define UTILS_STRING_H
|
||||||
|
|
||||||
#include <string>
|
#include <QString>
|
||||||
|
|
||||||
class QByteArray;
|
class QByteArray;
|
||||||
class QString;
|
class QLatin1String;
|
||||||
|
|
||||||
namespace Utils
|
namespace Utils
|
||||||
{
|
{
|
||||||
@@ -51,6 +51,19 @@ namespace Utils
|
|||||||
|
|
||||||
bool naturalCompareCaseSensitive(const QString &left, const QString &right);
|
bool naturalCompareCaseSensitive(const QString &left, const QString &right);
|
||||||
bool naturalCompareCaseInsensitive(const QString &left, const QString &right);
|
bool naturalCompareCaseInsensitive(const QString &left, const QString &right);
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
T unquote(const T &str, const QString "es = QLatin1String("\""))
|
||||||
|
{
|
||||||
|
if (str.length() < 2) return str;
|
||||||
|
|
||||||
|
for (auto const quote : quotes) {
|
||||||
|
if (str.startsWith(quote) && str.endsWith(quote))
|
||||||
|
return str.mid(1, str.length() - 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user