summaryrefslogtreecommitdiffstats
path: root/src/Util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Util.cpp')
-rw-r--r--src/Util.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Util.cpp b/src/Util.cpp
index 014f1f8..0a0b6a5 100644
--- a/src/Util.cpp
+++ b/src/Util.cpp
@@ -1,5 +1,7 @@
#include "Util.hpp"
+#include <QRegularExpression>
+
namespace Util {
QString trimQuotes(QString string, bool& trimmed)
{
@@ -132,4 +134,16 @@ namespace Util {
return ret;
}
+ QString& unescapeClonkString(QString&& string)
+ {
+ static QRegularExpression escapeExp(R"(\\[0-7]+)");
+ QRegularExpressionMatch match;
+ while((match = escapeExp.match(string)).hasMatch())
+ {
+ unsigned char c = (unsigned char)match.capturedRef(0).mid(1).toInt(0, 8);
+
+ string.replace(match.capturedStart(), match.capturedLength(), c);
+ }
+ return string;
+ }
}