diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-02-10 16:36:04 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-02-10 16:36:04 +0300 |
commit | 5a15b718a475f8c2809521ea3166de379bf85b36 (patch) | |
tree | 9b50a62cf5192469dc23448aace0d7ba7996ccf0 /src/utils/stringutils.cpp | |
parent | e19faa6874b92a949703e37e07e912c693545496 (diff) | |
download | mv-5a15b718a475f8c2809521ea3166de379bf85b36.tar.gz mv-5a15b718a475f8c2809521ea3166de379bf85b36.tar.bz2 mv-5a15b718a475f8c2809521ea3166de379bf85b36.tar.xz mv-5a15b718a475f8c2809521ea3166de379bf85b36.zip |
In parameters parsing function add support for multiply separators.
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; |