Split a string on the platform's PATH delimiter. Example: if delimiter is ":" then: "" --> [] ":" --> ["",""] "::" --> ["","",""] "/a/b/c" --> ["/a/b/c"] "/a/b/c:/d/e/f" --> ["/a/b/c","/d/e/f"] etc.
| 685 | // "/a/b/c:/d/e/f" --> ["/a/b/c","/d/e/f"] |
| 686 | // etc. |
| 687 | inline std::vector<std::string> split_source_prefixes(const std::string& s) |
| 688 | { |
| 689 | std::vector<std::string> out; |
| 690 | size_t last = 0; |
| 691 | size_t next = 0; |
| 692 | size_t delimiter_size = sizeof(kBackwardPathDelimiter) - 1; |
| 693 | while ((next = s.find(kBackwardPathDelimiter, last)) != std::string::npos) { |
| 694 | out.push_back(s.substr(last, next - last)); |
| 695 | last = next + delimiter_size; |
| 696 | } |
| 697 | if (last <= s.length()) { |
| 698 | out.push_back(s.substr(last)); |
| 699 | } |
| 700 | return out; |
| 701 | } |
| 702 | |
| 703 | } // namespace details |
| 704 |
no outgoing calls
no test coverage detected