Insert into str by using the iterator version of insert() : string insert « String « C++






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;
}
  
    
  








Related examples in the same category

1.string.insert()
2.Insert one string at location 10 of another string
3.string.insert( 3, string4, 0, string::npos )
4.Insert one string into another