summaryrefslogtreecommitdiffstats
path: root/src/Util.hpp
blob: c2ed916cc4e65a7164e218caf82d6a30c4b99bfd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#pragma once

#include <QString>
#include <QMap>

namespace Util {
    static const QMap<QChar, QChar> unescapeChars {
        {'n', '\n'},
    };

    QString trimQuotes(QString string, bool& trimmed);
    QString unescape(const QString& string, const QChar escapeChar = '\\');
    QString escape(const QString& string, const QChar escapeChar = '\\', const QString& escapeChars = "");
    QString joinEscape(const QStringList& list, const QChar joinChar, const QChar escapeChar = '\\');
    QStringList splitEscaped(const QString& joined, const QChar splitChar, const QChar escapeChar = '\\');
}