aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/support
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic/support')
-rw-r--r--engines/titanic/support/string.cpp4
-rw-r--r--engines/titanic/support/string.h6
2 files changed, 10 insertions, 0 deletions
diff --git a/engines/titanic/support/string.cpp b/engines/titanic/support/string.cpp
index 1400c25733..9961cfce59 100644
--- a/engines/titanic/support/string.cpp
+++ b/engines/titanic/support/string.cpp
@@ -58,6 +58,10 @@ CString CString::mid(uint start) const {
return mid(start, strSize - start);
}
+CString CString::deleteRight(uint count) const {
+ return (count >= size()) ? CString() : left(size() - count);
+}
+
int CString::indexOf(char c) const {
const char *charP = strchr(c_str(), c);
return charP ? charP - c_str() : -1;
diff --git a/engines/titanic/support/string.h b/engines/titanic/support/string.h
index 487c138358..71242c01c9 100644
--- a/engines/titanic/support/string.h
+++ b/engines/titanic/support/string.h
@@ -75,6 +75,12 @@ public:
CString mid(uint start) const;
/**
+ * Returns a substring consisting of the entire string
+ * except for a specified number of characters at the end
+ */
+ CString deleteRight(uint count) const;
+
+ /**
* Returns the index of the first occurance of a given character
*/
int indexOf(char c) const;