title: How to deal with "%1" in the argument of QString::arg()?
body: <p>Everybody loves</p>
  
  <pre><code>QString("Put something here %1 and here %2")
      .arg(replacement1)
      .arg(replacement2);
  </code></pre>
  
  <p>but things get itchy as soon as you have the faintest chance that <code>replacement1</code> actually contains <code>%1</code> or even <code>%2</code> anywhere. Then, the second <code>QString::arg()</code> will replace only the re-introduced <code>%1</code> or both <code>%2</code> occurrences. Anyway, you won't get the literal <code>"%1"</code> that you probably intended.</p>
  
  <p>Is there any standard trick to overcome this?</p>
  
  <p>If you need an example to play with, take this</p>
  
  <pre><code>#include &lt;QCoreApplication&gt;
  #include &lt;QDebug&gt;
  
  int main()
  {
      qDebug() &lt;&lt; QString("%1-%2").arg("%1").arg("foo");
      return 0;
  }
  </code></pre>
  
  <p>This will output</p>
  
  <pre><code>"foo-%2"
  </code></pre>
  
  <p>instead of</p>
  
  <pre><code>"%1-foo"
  </code></pre>
  
  <p>as might be expected (not).</p>
  
  <pre><code>    qDebug() &lt;&lt; QString("%1-%2").arg("%2").arg("foo");
  </code></pre>
  
  <p>gives</p>
  
  <pre><code>"foo-foo"
  </code></pre>
  
  <p>and</p>
  
  <pre><code>    qDebug() &lt;&lt; QString("%1-%2").arg("%3").arg("foo");
  </code></pre>
  
  <p>gives</p>
  
  <pre><code>"%3-foo"
  </code></pre>