BlinkenArea - GitList
Repositories
Blog
Wiki
permissioner
Code
Commits
Branches
Tags
Search
Tree:
5e011c9
Branches
Tags
master
permissioner
libpermissioner
src
StringUtils.cpp
move most sources into libpermissioner
Stefan Schuermans
commited
5e011c9
at 2020-08-18 20:27:07
StringUtils.cpp
Blame
History
Raw
#include <permissioner/StringUtils.h> #include <stdexcept> #include <sstream> #include <string> void StringUtils::getNextField(std::string const &str, std::string::size_type &pos, std::string &field, std::string const &name) { static const std::string whitespace(" \t"); std::string::size_type begin = str.find_first_not_of(whitespace, pos); if (begin == std::string::npos) { std::stringstream msg; msg << "<" << name <<"> field missing in \"" << str << "\""; throw std::runtime_error(msg.str()); } std::string::size_type end = str.find_first_of(whitespace, begin); if (end == std::string::npos) { end = str.length(); } field = str.substr(begin, end - begin); pos = str.find_first_not_of(whitespace, end); if (pos == std::string::npos) { pos = str.length(); } }