-
Notifications
You must be signed in to change notification settings - Fork 0
/
String.h
77 lines (67 loc) · 2.42 KB
/
String.h
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
#ifndef ALEX_STRING_H_
#define ALEX_STRING_H_
#include <iostream>
#include <fstream>
#include <functional>
#include "ArrayWrapper.h"
using namespace std;
class String
{
private:
char* buffer;
unsigned int length;
unsigned int bufferSize;
String(unsigned int);
void initialize(int = 0);
public:
String();
String(const char[]);
String(const String&);
~String();
String& operator=(const String&);
String& operator=(const char[]);
friend bool operator==(const String&, const String&);
friend bool operator!=(const String&, const String&);
friend bool operator<(const String&, const String&);
friend bool operator>(const String&, const String&);
friend bool operator>=(const String&, const String&);
friend bool operator<=(const String&, const String&);
friend bool operator==(const char[], const String&);
friend bool operator==(const String&, const char[]);
friend bool operator!=(const char[], const String&);
friend bool operator!=(const String&, const char[]);
String& operator+=(const String&);
String& operator+=(const char[]);
String& operator+=(const char);
char& operator[](const unsigned int);
friend String operator+(const String&, const String&);
friend String operator+(const String&, const char[]);
friend String operator+(const String&, const char);
friend String operator+(const char[], const String&);
friend String operator+(const char, const String&);
friend ostream& operator<<(ostream&, const String&);
friend istream& operator>>(istream&, String&);
friend istream& getline(istream&, String&);
friend istream& getline(istream&, String&, char);
unsigned int getLength();
String substring(unsigned int, unsigned int);
String substringLength(unsigned int, unsigned int);
ArrayWrapper<String> split(String&, bool = true);
ArrayWrapper<String> split(const char[], bool = true);
ArrayWrapper<String> split(char, bool = true);
ArrayWrapper<String> split(function<bool(char)>);
unsigned int find(String&, bool = true, unsigned int = 0);
unsigned int find(const char[], bool = true, unsigned int = 0);
unsigned int find(char, bool = true, unsigned int = 0);
long getHashCode() const;
String trim();
String trimStart();
String trimEnd();
String stripCharacter(char, bool = true);
String stripCharacter(function<bool(char)>);
String toLower();
String toUpper();
String clone();
char* c_string();
};
#endif /* ALEX_STRING_H_ */