MCPcopy Create free account
hub / github.com/Bush2021/chrome_plus / StringSplit

Function StringSplit

src/utils.cc:44–62  ·  view source on GitHub ↗

String manipulation functions Specify the delimiter and wrapper to split the string.

Source from the content-addressed store, hash-verified

42// String manipulation functions
43// Specify the delimiter and wrapper to split the string.
44std::vector<std::wstring> StringSplit(std::wstring_view str,
45 const wchar_t delim,
46 std::wstring_view enclosure) {
47 std::vector<std::wstring> result;
48 auto parts = std::views::split(str, delim);
49 for (const auto& part : parts) {
50 std::wstring_view part_sv(part);
51 if (!enclosure.empty()) {
52 if (!part_sv.empty() && part_sv.front() == enclosure.front()) {
53 part_sv.remove_prefix(1);
54 }
55 if (!part_sv.empty() && part_sv.back() == enclosure.back()) {
56 part_sv.remove_suffix(1);
57 }
58 }
59 result.emplace_back(part_sv);
60 }
61 return result;
62}
63
64std::vector<std::string> StringSplit(std::string_view str,
65 const char delim,

Callers 3

LoadConfigMethod · 0.85
compression_htmlFunction · 0.85
LaunchCommandsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected