diff options
Diffstat (limited to 'common/str.cpp')
| -rw-r--r-- | common/str.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/common/str.cpp b/common/str.cpp index 01d24c1e75..88aca87bb4 100644 --- a/common/str.cpp +++ b/common/str.cpp @@ -86,7 +86,16 @@ String::String(const String &str) } assert(_str != 0); } + +String::String(char c) +: _len(0), _str(_storage) { + _storage[0] = c; + _storage[1] = 0; + + _len = (c == 0) ? 0 : 1; +} + String::~String() { decRefCount(_extern._refCount); } @@ -437,6 +446,18 @@ String operator +(const String &x, const char *y) { return temp; } +String operator +(char x, const String &y) { + String temp(x); + temp += y; + return temp; +} + +String operator +(const String &x, char y) { + String temp(x); + temp += y; + return temp; +} + char *ltrim(char *t) { while (isspace(*t)) t++; |
