I would like to zeropad a number such that it has 5 digits and get it as a string. This can be done with the following:
unsigned int theNumber = 10;
std::string theZeropaddedString = (boost::format("%05u") % theNumber).str();
However, I do not want to hardcode the number of digits (i.e. the 5 in "%05u").
How can I use boost::format, but specify the number of digits via a variable?
(i.e. put the number of digits in unsigned int numberOfDigits = 5
and then use numberOfDigits with boost::format)