Mega Code Archive

 
Categories / C++ / String
 

Insert into str by using the iterator version of insert()

#include <iostream> #include <string> #include <cctype> #include <algorithm> #include <vector> using namespace std; int main() {   string strA("This is a test.");   string::iterator itr;   // Insert into str by using the iterator version of insert().   cout <<"Insert into a string via an iterator.\n";   string strB(" bigger");   strA.insert(itr, strB.begin(), strB.end());   cout << strA << "\n\n";   return 0; }