summaryrefslogtreecommitdiffstats
path: root/src/Util.cpp
blob: 4db3773cb307b5e0e31167af6390c8c41bc6c470 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "Util.hpp"

namespace Util {
    QString& trimQuotes(QString&& string, bool& trimmed)
    {
        trimmed = false;
        if(string.length() >= 2 && string.at(0) == '"' && string.at(string.length() - 1) == '"')
        {
            string.remove(0, 1);
            string.remove(string.length() - 1, 1);
            trimmed = true;
        }
        return string;
    }

    QString& trimQuotes(const QString& string, bool& trimmed)
    {
        return trimQuotes(QString(string), trimmed);
    }
}