From 44bffd8cefd056356611b98e1f4696bcf2f553d8 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sat, 7 May 2022 10:47:38 +0300 Subject: Autocommit at 07.05.2022 @ 10:47 --- src/Generic/String/String.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/Generic/String/String.cpp') 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) { -- cgit v1.3.1-23-gd82d