diff options
Diffstat (limited to 'src/utils/stringutils.cpp')
-rw-r--r-- | src/utils/stringutils.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index 9cc21f23a..e7887bc48 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -210,6 +210,21 @@ size_t findI(std::string text, const StringVect &list) return std::string::npos; } +size_t findAny(const std::string &restrict text, + const std::string &restrict chars, + const size_t pos) +{ + size_t idx = std::string::npos; + const size_t sz = chars.size(); + for (size_t f = 0; f < sz; f ++) + { + const size_t idx2 = text.find(chars[f], pos); + if (idx2 != std::string::npos && idx2 < idx) + idx = idx2; + } + return idx; +} + namespace { unsigned int base = 94; |