mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 12:59:56 -07:00
Refactor out helper function Utils::String::unquote
Remove redundant include
This commit is contained in:
parent
47960b2592
commit
712e6a0e5c
2 changed files with 25 additions and 24 deletions
|
@ -30,10 +30,10 @@
|
|||
#ifndef UTILS_STRING_H
|
||||
#define UTILS_STRING_H
|
||||
|
||||
#include <string>
|
||||
#include <QString>
|
||||
|
||||
class QByteArray;
|
||||
class QString;
|
||||
class QLatin1String;
|
||||
|
||||
namespace Utils
|
||||
{
|
||||
|
@ -49,6 +49,19 @@ namespace Utils
|
|||
bool naturalCompareCaseInsensitive(const QString &left, const QString &right);
|
||||
|
||||
QString wildcardToRegex(const QString &pattern);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue