I have a function that received a string ex. "rn"
and I need to append the '\'
character to each letter of the string to get "\r\n"
. In order to append the '\'
character, I need to escape it with an additional '\'
, however that gives me the wrong string.
For example:
QString s = "rn";
QString n = QString("\\%1\\%2").arg(s[0]).arg(s[1]);
qDebug() << n.compare("\r\n");
Outputs 79 instead of 0. I need the first string (s) to be identical to "\r\n"
but I'm not sure how I can properly append the '\'
character.