Hello!

Suppose I want to create a string that shows a progress status bar, something like:

"Processing file 1 of 211 files: 5% done".

I know of two methods one could do that by working with QStrings: one is to pick the numbers and convert them to QStrings by using QString::number(...) and concatenate them using +:

Qt Code:
  1. "Processing file " + QString::number(currFile) + " of " + QString::number(totalFiles) + " files: " + QString::number(currProgress) + "% done";
To copy to clipboard, switch view to plain text mode 

and the other is by using args:

Qt Code:
  1. "Processing file %1 of %2 files: %3% done".arg(currFile).arg(totalFiles).arg(currProgress);
To copy to clipboard, switch view to plain text mode 


So two questions:
* First, is there another method to do this?
* Second, which of them is the best for situations like the one mentioned above? - I know that if someone wants to guarantee a minimal amount of numbers to be displayed, arg() is better since number(...) don't provide that functionality, but what about speed and memory efficiency? - Not forgetting to consider in the evaluation some extra options such as to use QStringBuilder to make the + concatenation faster.


Thanks,

Momergil