add String::lastChar() method
svn-id: r10684
This commit is contained in:
parent
b41c052ab5
commit
cf3ac50e3c
2 changed files with 5 additions and 0 deletions
|
@ -140,6 +140,10 @@ String &String::operator += (char c) {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char lastChar() const {
|
||||||
|
return (_len > 0) ? _str[_len-1] : 0;
|
||||||
|
}
|
||||||
|
|
||||||
void String::deleteLastChar() {
|
void String::deleteLastChar() {
|
||||||
if (_len > 0) {
|
if (_len > 0) {
|
||||||
ensureCapacity(_len - 1, true);
|
ensureCapacity(_len - 1, true);
|
||||||
|
|
|
@ -108,6 +108,7 @@ public:
|
||||||
return _str[idx];
|
return _str[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char lastChar() const;
|
||||||
void deleteLastChar();
|
void deleteLastChar();
|
||||||
void deleteChar(int p);
|
void deleteChar(int p);
|
||||||
void clear();
|
void clear();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue