Code clean up

This commit is contained in:
Chocobo1 2020-08-27 00:06:54 +08:00
commit 307ca61c86
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
3 changed files with 14 additions and 14 deletions

View file

@ -30,7 +30,7 @@
#ifndef UTILS_STRING_H
#define UTILS_STRING_H
#include <QLatin1String>
#include <QChar>
#include <QVector>
class QString;
@ -54,13 +54,13 @@ namespace Utils
QString wildcardToRegex(const QString &pattern);
template <typename T>
T unquote(const T &str, const QString &quotes = QLatin1String("\""))
T unquote(const T &str, const QString &quotes = QChar('"'))
{
if (str.length() < 2) return str;
for (const auto &quote : quotes) {
for (const QChar quote : quotes) {
if (str.startsWith(quote) && str.endsWith(quote))
return str.mid(1, str.length() - 2);
return str.mid(1, (str.length() - 2));
}
return str;