title: C++ Qt QString replace double backslash with one
body: <p>I have a QString with following content:</p>
  
  <blockquote>
    <p>"MXTP24\\x00\\x00\\xF4\\xF9\\x80\r\n"</p>
  </blockquote>
  
  <p>I want it to become:</p>
  
  <blockquote>
    <p>"MXTP24\x00\x00\xF4\xF9\x80\r\n"</p>
  </blockquote>
  
  <p>I need to replace the "\x" to "\x" so that I can start parsing the values. But the following code, which I think should do the job is not doing anything as I get the same string before and after:</p>
  
  <pre><code>qDebug() &lt;&lt; "BEFORE: " &lt;&lt; data;
  data = data.replace("\\\\x", "\\x", Qt::CaseSensitivity::CaseInsensitive);
  qDebug() &lt;&lt; "AFTER: " &lt;&lt; data;
  </code></pre>
  
  <p>Here, no change!</p>
  
  <p><a href="https://i.stack.imgur.com/GzkPO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GzkPO.png" alt="enter image description here"></a></p>
  
  <p>Then I tried like this:</p>
  
  <pre><code>data = data.replace("\\x", "\x", Qt::CaseSensitivity::CaseInsensitive);
  </code></pre>
  
  <p>Then compiler complaines that <code>\x used with no following hex digits!</code> </p>
  
  <p>any ideas?</p>