-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathP86stringFunction.cpp
More file actions
61 lines (41 loc) · 1.04 KB
/
P86stringFunction.cpp
File metadata and controls
61 lines (41 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// String Functions
#include<iostream>
#include<string>
using namespace std;
int main(){
// (4.) Compare
// string s1="abc";
// string s2="xyz";
// cout<< s2.compare(s1) <<endl;
// (5.) Erase()
// string s1="abhishek";
// s1.erase(3,3);
// cout<<s1 <<endl;
// (6.) Find()
// string s1="abhishek";
// cout<<s1.find("bhi")<<endl;
// (7.) Insert()
// string s1="abhishek";
// s1.insert(8, "pipuu");
// cout<<s1<<endl;
// (8.) length() or size()
// string s1="preethiharshini";
// cout<<s1.size()<<endl;
// length() used at the time of iteration
// for (int i = 0; i < s1.length(); i++)
// {
// cout<<s1[i]<<endl;
// }
// // (9.) substr()
// string s1="abhishek";
// string s=s1.substr(4,3);
// cout<<s<<endl;
// (10.) stoi() // string to integer
// string s1="786";
// int x=stoi(s1);
// cout<<x<<endl;
// integer to string
int x=786;
cout<<to_string(x)<<endl;
return 0;
}