diff options
Autocommit at 07.05.2022 @ 10:47
1 files changed, 8 insertions, 3 deletions
| -rw-r--r-- | src/Generic/String/String.cpp | 11 |
diff --git a/src/Generic/String/String.cpp b/src/Generic/String/String.cpp index b1e2889..570a2c6 100644 --- a/src/Generic/String/String.cpp +++ b/src/Generic/String/String.cpp @@ -9,16 +9,17 @@ void String::free() { void String::copyFrom(const String& other) { str = new char[other.length]; - strcpy(str, other.str); + strncpy(str, other.str, other.count); length = other.length; + count = other.count; } /* Public */ String::String(const char* str) { - length = strlen(str) + 1; // capture terminating zero + count = length = strlen(str) + 1; // capture terminating zero this->str = new char[length]; - strncpy(this->str, str, length); + strncpy(this->str, str, count); } const char* String::get_cstr() const { @@ -37,6 +38,10 @@ String& String::operator+=(const String& other) { return *this; } +String& String::operator+=(char other) { + if () +} + String::String() : String("") {} String::String(const String& other) { |
