add String::lastChar() method

svn-id: r10684
This commit is contained in:
Max Horn 2003-10-08 21:01:50 +00:00
parent b41c052ab5
commit cf3ac50e3c
2 changed files with 5 additions and 0 deletions

View file

@ -140,6 +140,10 @@ String &String::operator += (char c) {
return *this;
}
char lastChar() const {
return (_len > 0) ? _str[_len-1] : 0;
}
void String::deleteLastChar() {
if (_len > 0) {
ensureCapacity(_len - 1, true);

View file

@ -108,6 +108,7 @@ public:
return _str[idx];
}
char lastChar() const;
void deleteLastChar();
void deleteChar(int p);
void clear();