#include<iostream>
using namespace std;
void demo_append()
{
//append() :- used to extend the current string by appending another string to it.
string s1="Manish";
string s2="Sinha";
string s3="Gupta";
s2=[Link](s2);
[Link](s3);
cout<<s2;
}
void demo_assign()
{
//assign():- Used to assign a new content to the existing string by replacing its current content
string s1="Manish";
string s2=" Ajay Sinha";
cout<<s1 <<endl;
[Link](s2);
cout<<s1 <<endl;
}
void dLength()
{
//length(): is used to find the length of the string (number of character in a string)
//size(): is used to find the length of the string (number of character in a string)
string str="Manjeet";
cout<<"Length of string:"<<[Link]()<<endl;
cout<<"size of string:"<<[Link]();
void demo_at()
{
//at(): It returns a character at a specified position.
string str="Manjeet";
//cout<<[Link](2);
for(int i=0;i<[Link]();i++)
cout<<[Link](i);
}
void demo_compare()
{
//compare() : used to compare two string objects. This funtion returns zero(0), if all the
//characters of both string objects are same.
string s1="Manjeet";
string s2="Manjeet1";
int x=[Link](s2);
if(x==0)
cout<<"equal";
else
cout<<"not equal";
void demo_insert()
{
//insert(): is used to insert string at specified position.
string s1="SUSH";
string s2="BHA";
//insert s2 in s1 from 2nd position
[Link](2,s2);
cout<<s1;
}
void demp_erase()
{
//erase(): is used to remvoe the characters from specified position
string s1="SUBHASH";
//erase 3 characters in s1 from 2nd position
[Link](2,3);
cout<<s1;
void demo_find()
{
//find(): searches a string for a specified substring and returns
//the position of the first occurrence in the string.
int pos;
string s1="I am [Link](CS) IV Semester student";
pos=[Link]("am");
cout<<endl<<pos;
}
void demo_replace()
{
//replace(): used to replace specified character by a specified string.
string s1="SOOOASH";
string s2="UBH";
[Link](1,3,s2);
cout<<s1;
}
main()
{
//swap(): exchange the contents of two string objects;
string s1="Manjeet";
string s2="Ranjeet";
cout<<s1<<"\t\t"<<s2<<endl;
[Link](s2);
cout<<s1<<"\t\t"<<s2;
return 0;
}