| 84 | } |
| 85 | |
| 86 | std::vector<std::string> StringUtils::split(const std::string& input, const std::string& delimiter, |
| 87 | bool ignoreEmptyStringParts) { |
| 88 | auto result = std::vector<std::string>(); |
| 89 | auto prevPos = 0u; |
| 90 | auto currentPos = findDelim(input, delimiter, prevPos); |
| 91 | while (currentPos != std::string::npos) { |
| 92 | auto stringPart = input.substr(prevPos, currentPos - prevPos); |
| 93 | if (!ignoreEmptyStringParts || !stringPart.empty()) { |
| 94 | result.push_back(input.substr(prevPos, currentPos - prevPos)); |
| 95 | } |
| 96 | prevPos = currentPos + delimiter.size(); |
| 97 | currentPos = findDelim(input, delimiter, prevPos); |
| 98 | } |
| 99 | result.push_back(input.substr(prevPos)); |
| 100 | return result; |
| 101 | } |
| 102 | |
| 103 | std::vector<std::string> StringUtils::splitBySpace(const std::string& input) { |
| 104 | std::istringstream iss(input); |