aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/str.cpp4
-rw-r--r--common/str.h1
2 files changed, 5 insertions, 0 deletions
diff --git a/common/str.cpp b/common/str.cpp
index 416b4d828f..0d2d3613f5 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -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);
diff --git a/common/str.h b/common/str.h
index af318ee3d0..a4570bead8 100644
--- a/common/str.h
+++ b/common/str.h
@@ -108,6 +108,7 @@ public:
return _str[idx];
}
+ char lastChar() const;
void deleteLastChar();
void deleteChar(int p);
void clear();