MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / split_source_prefixes

Function split_source_prefixes

src/backward.h:687–701  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

685// "/a/b/c:/d/e/f" --> ["/a/b/c","/d/e/f"]
686// etc.
687inline 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

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected