mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
added ParseTagString code
This commit is contained in:
parent
269a5500d8
commit
6b46d12558
|
@ -7,10 +7,38 @@ namespace chatterino {
|
|||
QString ParseTagString(const QString &input)
|
||||
{
|
||||
QString output = input;
|
||||
output.detach();
|
||||
|
||||
// code goes here
|
||||
bool changed = false;
|
||||
|
||||
return output;
|
||||
for (int i = 0; i < output.length() - 1; i++) {
|
||||
if (output[i] == '\\') {
|
||||
QChar c = output[i + 1];
|
||||
|
||||
if (c == 'n') {
|
||||
output[i] == '\n';
|
||||
} else if (c == 'r') {
|
||||
output[i] == '\r';
|
||||
} else if (c == 's') {
|
||||
output[i] == ' ';
|
||||
} else if (c == '\\') {
|
||||
output[i] == '\\';
|
||||
} else if (c == ':') {
|
||||
output[i] == ';';
|
||||
} else {
|
||||
output[i] = output[i + 1];
|
||||
}
|
||||
output[i + 1] = '\0';
|
||||
changed = true;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
return output.replace("\0", "");
|
||||
} else {
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
|
Loading…
Reference in a new issue