aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/true_talk/tt_string.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic/true_talk/tt_string.cpp')
-rw-r--r--engines/titanic/true_talk/tt_string.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/engines/titanic/true_talk/tt_string.cpp b/engines/titanic/true_talk/tt_string.cpp
index 7a0078788d..70d6fe3fcf 100644
--- a/engines/titanic/true_talk/tt_string.cpp
+++ b/engines/titanic/true_talk/tt_string.cpp
@@ -99,4 +99,23 @@ void TTstring::save(SimpleFile *file) const {
file->writeFormat("%s", c_str());
}
+TTstring TTstring::tokenize(const char *delim) {
+ const char *strP = _data->_string.c_str();
+ const char *splitP = nullptr, *chP;
+
+ for (const char *d = delim; d; ++d) {
+ chP = strchr(strP, *d);
+ if (chP && (splitP == nullptr || chP < splitP))
+ splitP = chP;
+ }
+
+ if (splitP) {
+ TTstring result(CString(strP, splitP));
+ _data->_string = CString(splitP + 1);
+ return result;
+ } else {
+ return TTstring();
+ }
+}
+
} // End of namespace Titanic