-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring.h
More file actions
52 lines (46 loc) · 1.41 KB
/
string.h
File metadata and controls
52 lines (46 loc) · 1.41 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
#pragma once
#include <iostream>
#include <cstddef>
class String {
public:
//Constructors
String();
String(const char* str);
String(const String& other);
String(String&& other) noexcept;
//Destructor
~String();
//Member Functions
size_t Length() const;
char& CharacterAt(size_t index);
const char& CharacterAt(size_t index) const;
bool EqualTo(const String& other) const;
String& Append(const String& str);
String& Prepend(const String& str);
const char* CStr() const;
String& ToLower();
String& ToUpper();
size_t Find(const String& str) const;
size_t Find(size_t startIndex, const String& str) const;
String& Replace(const String& find, const String& replace);
String& ReadFromConsole();
const String& WriteToConsole() const;
String& Wobble();
//Overloads
bool operator==(const String& other) const;
bool operator!=(const String& other) const;
bool operator<(const String& other) const;
bool operator>(const String& other) const;
String& operator=(const String& str);
String& operator=(String&& other) noexcept;
char& operator[](size_t index);
const char& operator[](size_t index) const;
String operator+(const String& other) const;
String& operator+=(const String& other);
friend std::ostream& operator<<(std::ostream& out, const String& str);
friend std::istream& operator>>(std::istream& in, String& str);
private:
char* _str;
enum class AdoptPointer {};
String(AdoptPointer, char* str);
};