-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathString.hpp
120 lines (84 loc) · 2.5 KB
/
String.hpp
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#ifndef __STRING__HPP
#define __STRING__HPP
#include<iostream>
using namespace std;
class String
{
char *contains;
int length;
unsigned int String::nposition=2147483647;
String();
String(const String &);
String(const char*);
~String();
String& operator=(const char*);
String& operator=(const String&);
String operator+(const String&);
bool operator==(String &);
bool operator!=(String &);
int operator<(String &);
int operator>(String &);
char front();
char back();
char at(int);
int empty();
int Length();
int size();
void pop_back();
void swap(const String&);
String& erase();
String& erase(int);
String& erase(int,int);
void push_back(char);
void assign(int,char);
void assign(const char*);
void assign(const char*,int);
void assign(const char*,int,int);
void assign(const String &);
void assign(const String &,int);
void assign(const String &,int,int);
void append(int,char);
void append(const char*);
void append(const char*,int);
void append(const String&);
void append(const String &,int count);
void append(const String &e,int from,int count);
void insert(int at,int count,char e);
void insert(int at,const char *e);
void insert(int at,const char *e,int count);
void insert(int at,String &e);
void insert(int at,const String &e,int count);
int compare(const char *e);
int compare(String &s);
unsigned int find(const char *e,int pos=0);
unsigned int find(const String &e,int pos=0);
unsigned int find_first_of(const char *e,int pos=0);
unsigned int find_first_of(const String &e,int pos=0);
unsigned int find_last_of(const char *e,int pos=0);
unsigned int find_last_of(const String &e,int pos=0);
unsigned int find_first_not_of(const char *e,int pos=0);
unsigned int find_first_not_of(const String &e,int pos=0);
unsigned int find_last_not_of(const char *e,int pos=0);
unsigned int find_last_not_of(const String &e,int pos=0);
void replace(int at,int repcount,int count,const char e);
void replace(int at,int repcount,const char *e);
void replace(int at,int repcount,int count,const char *e);
void replace(int at,int repcount,const String &e);
void replace(int at,int repcount,int count,const String &e);
String substr(int from,int to);
String& upperCase();
String& upperCase(int from,int to);
String& lowerCase();
String& lowerCase(int from,int to);
String& toggleCase();
String& toggleCase(int from,int to);
bool endsWith(const char *e);
String& reverse();
friend ostream& operator<<(ostream &cout,String &object);
};
ostream& operator<<(ostream &cout,String &object)
{
cout<<object.contains;
return cout;
}
#endif