diff options
Diffstat (limited to 'common/str.cpp')
-rw-r--r-- | common/str.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/common/str.cpp b/common/str.cpp index cd2bd631ac..d62a39511e 100644 --- a/common/str.cpp +++ b/common/str.cpp @@ -108,6 +108,14 @@ String &String::operator =(const String &str) { return *this; } +String& String::operator =(char c) { + ensureCapacity(1, false); + _len = 1; + _str[0] = c; + _str[1] = 0; + return *this; +} + String &String::operator +=(const char *str) { int len = strlen(str); if (len > 0) { @@ -139,10 +147,6 @@ String &String::operator += (char c) { return *this; } -char String::lastChar() const { - return (_len > 0) ? _str[_len-1] : 0; -} - void String::deleteLastChar() { if (_len > 0) { ensureCapacity(_len - 1, true); |