| 39 | } |
| 40 | |
| 41 | void StringToVector(const string_view &inString, vector<string> &outVector, const string_view &inDelimiter, bool inClearVector) |
| 42 | { |
| 43 | JPH_ASSERT(inDelimiter.size() > 0); |
| 44 | |
| 45 | // Ensure vector empty |
| 46 | if (inClearVector) |
| 47 | outVector.clear(); |
| 48 | |
| 49 | // No string? no elements |
| 50 | if (inString.empty()) |
| 51 | return; |
| 52 | |
| 53 | // Start with initial string |
| 54 | string s(inString); |
| 55 | |
| 56 | // Add to vector while we have a delimiter |
| 57 | size_t i; |
| 58 | while (!s.empty() && (i = s.find(inDelimiter)) != string::npos) |
| 59 | { |
| 60 | outVector.push_back(s.substr(0, i)); |
| 61 | s.erase(0, i + inDelimiter.length()); |
| 62 | } |
| 63 | |
| 64 | // Add final element |
| 65 | outVector.push_back(s); |
| 66 | } |
| 67 | |
| 68 | void VectorToString(const vector<string> &inVector, string &outString, const string_view &inDelimiter) |
| 69 | { |
no test coverage detected