I want to stream out a std::string
but I want to be able to do it without the first two characters or the last two characters.
For example:
string foo{"bu blah blah blee le"};
cout << foo.substr(2) << endl << foo.substr(0, foo.size() - 2) << endl;
Are there any iomanip
tools for that? or should I just go ahead and construct the temporary string
s?
You could use
cout.write
:which also returns the stream, so you can do: