more on String Class and available methods





This video tutorial explains more about the string and and available functions in c++.

source code for this tutorial

#include <iostream>

using namespace std;

int main()
{
string data("learning lad");

cout << data <<endl;

data.append(" rocks");
cout << data <<endl;

cout << data.size()<<endl;
data.insert(0,"The ");
cout << data <<endl;

cout << data.substr(4)<<endl;

data.erase(1,4);
cout << data <<endl;
    return 0;
}

 
Back To Top