title: How to use QString::replace on a const& parameter?
body: <p>What is the best way to call <a href="https://doc.qt.io/qt-5/qstring.html#replace-7" rel="nofollow noreferrer"><code>QString::replace</code></a> in a non-destructive way ?  </p>
  
  <p>I have a function taking a <code>const QString&amp;</code> as a parameter, then I can't directly call call <code>replace</code> because this function modify the object (same for <code>remove</code>).<br>
  I would like to chain calls on the parameter and to use that as an expression like :</p>
  
  <pre><code>return myString.replace(QRegExp("\\s+"), "_").remove("someSuffix");
  </code></pre>
  
  <p>Of course I could change the function definition to take the QString by value instead of reference, but I don't like this solution. One could later wonder why we are not passing by reference like the rest of the parameters.</p>
  
  <p>I can also make a local copy but is there any more practical/clean way ?</p>