aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2003-10-08 21:01:50 +0000
committerMax Horn2003-10-08 21:01:50 +0000
commitcf3ac50e3c76e3aa0d9e5c30ba4e83e6a4c4d85d (patch)
treeda55af884487280e2060cdd3c50207bffe9bb7b8
parentb41c052ab5b117ca236fd1ea48c9fe7dbe671575 (diff)
downloadscummvm-rg350-cf3ac50e3c76e3aa0d9e5c30ba4e83e6a4c4d85d.tar.gz
scummvm-rg350-cf3ac50e3c76e3aa0d9e5c30ba4e83e6a4c4d85d.tar.bz2
scummvm-rg350-cf3ac50e3c76e3aa0d9e5c30ba4e83e6a4c4d85d.zip
add String::lastChar() method
svn-id: r10684
-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();