Example of String Utility Operations

   string strA = "hello";
printCstring(strA.c_str());
for ( int i = 0; i < strA.length(); i++ )
cout << strA.data()[i];
cout << endl;
   strA.resize(10,'#');    // value is "hello#####"
strA.resize(3); // value is "hel"
   // The next function is not supported by Visual C++ 6.0
strA.clear();
// but erase can be used instead
strA.erase();
if ( strA.empty() )
cout << "empty" << endl;
   //size_type copy(char[] s, size_type n,
// size_type pos = 0) const;
strA = "abcdefghi";
const int MAX = 5;
char buff[MAX];
strA.copy(buff,MAX-1,2);
buff[MAX-1] = 0; // add C string terminator
cout << buff << endl; // value of buff is "cedf"