diff options
Diffstat (limited to 'osframework/source/SexyAppFramework/Common.cpp')
-rw-r--r-- | osframework/source/SexyAppFramework/Common.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/osframework/source/SexyAppFramework/Common.cpp b/osframework/source/SexyAppFramework/Common.cpp index fd11918..7947763 100644 --- a/osframework/source/SexyAppFramework/Common.cpp +++ b/osframework/source/SexyAppFramework/Common.cpp @@ -1377,3 +1377,24 @@ int Sexy::GetEnvIntOption(const char *option, int value) return atoi(s); return value; } + +/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +void Sexy::Split(const std::string& s, const std::string& delim, + std::vector<std::string>& ret) +{ + size_t last = 0; + size_t index = s.find_first_of(delim, last); + + while (index != std::string::npos) + { + ret.push_back(s.substr(last, index - last)); + last = index + 1; + index = s.find_first_of(delim, last); + } + if (index - last > 0) + { + ret.push_back(s.substr(last, index-last)); + } +} + |