From 5a15b718a475f8c2809521ea3166de379bf85b36 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 10 Feb 2016 16:36:04 +0300 Subject: In parameters parsing function add support for multiply separators. --- src/utils/stringutils.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/utils/stringutils.cpp') 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; -- cgit v1.2.3-70-g09d2