I\'m using std::string and need to left pad them to a given width. What is the recommended way to do this in C++?
std::string
Sample input:
123
You can use it like this:
std::string s = "123"; s.insert(s.begin(), paddedLength - s.size(), ' ');