c++ string
#include <iostream>
#include<string>
using namespace std;
int main(
int argc,
char *argv[])
{
char *p=
"hello ,good morning";
string str;
str=
"tell me you love the world";
string s01(p);
string s02(str);
string s03(p,
5);
string s04(str,
12,
15);
string s05(
10,
'c');
const char *p1=str.data();
const char *p2=str.c_str();
int size1=str.length();
str.reserve(
16);
str.at(
17);
str[
17];
string s(
"abcd");
s.compare(
"abcd");
s.compare(
"dcba");
s.compare(
"ab");
s.compare(s);
s.compare(
0,
2,s,
2,
2);
s.compare(
1,
2,
"bcx",
2);
s.assign(str,
0,
4);
s.assign(str,
0,
string::npos);
s.assign(
"hell",
4);
s.append(
5,
'c');
s.insert(
0,
"my name");
s.insert(
1,str);
s.replace(
1,
2,
"nternationalizatio");
s.erase(
13);
s.erase(
7,
5);
s=
"hello the world";
cout<<s.find(
"the",
0,
1);
s.substr();
s.substr(
11);
s.substr(
5,
6);
return 0;
}