aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/StringUtil.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/StringUtil.cc')
-rw-r--r--src/FbTk/StringUtil.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/FbTk/StringUtil.cc b/src/FbTk/StringUtil.cc
index 602211e..4678f03 100644
--- a/src/FbTk/StringUtil.cc
+++ b/src/FbTk/StringUtil.cc
@@ -164,6 +164,24 @@ string findExtension(const string &filename) {
164 return filename.substr(start_pos + 1); 164 return filename.substr(start_pos + 1);
165} 165}
166 166
167string::size_type findCharFromAlphabetAfterTrigger(const std::string& in, char trigger, const char alphabet[], size_t len_alphabet, size_t* found) {
168 for (const char* s = in.c_str(); *s != '\0'; ) {
169 if (*s++ == trigger && *s != '\0') {
170 for (const char* a = alphabet; (a - alphabet) < len_alphabet; ++a) {
171 if (*s == *a) {
172 if (found) {
173 *found = a - alphabet;
174 }
175 return s - in.c_str() - 1;
176 }
177 }
178 s++;
179 }
180 }
181 return string::npos;
182}
183
184
167string replaceString(const string &original, 185string replaceString(const string &original,
168 const char *findthis, 186 const char *findthis,
169 const char *replace) { 187 const char *replace) {