#include <string>
#include <iostream>
using namespace std;
int main()
{
string a("abcd efg"); // or a="abcd efg";
string b("xyz ijk");
string c;
cout << "String empty: " << c.empty() << endl; // String empty: 1
c = a + b; // concatenation
cout << c << endl; // abcd efgxyz ijk
string d = c;
cout << d << endl <<"\n\n"; // abcd efgxyz ijk
string g("abc abc abd abc");
cout << "String g: " << g << endl; // String g: abc abc abd abc
cout << "Replace 12,1,\"xyz\",3: " << g.replace(12,1,"xyz",3) << endl; // Replace 12,1,"xyz",3: abc abc abd xyzbc
cout << g.replace(0,3,"xyz",3) << endl; // xyz abc abd xyzbc
cout << g.replace(4,3,"xyz",3) << endl; // xyz xyz abd xyzbc
cout << g.replace(4,3,"ijk",1) << endl; // xyz i abd xyzbc
cout << "Find: " << g.find("abd",1) << endl; // Find: 6
cout << g.find("qrs",1) << endl << "\n\n" ;
string h("abc abc abd abc");
cout << "String h: " << h << endl;
cout << "Find \"abc\",0: " << h.find("abc",0) << endl; // Find "abc",0: 0
cout << "Find \"abc\",1: " << h.find("abc",1) << endl; // Find "abc",1: 4
return 0;
}
/**
* References:
* www.cplusplus.com/
* https://sites.google.com/site/smilitude/
* */