MCPcopy Create free account
hub / github.com/VCVRack/Rack / ellipsizePrefix

Function ellipsizePrefix

src/string.cpp:132–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130
131
132std::string ellipsizePrefix(const std::string& s, size_t maxCodepoints) {
133 if (maxCodepoints == 0)
134 return "";
135 std::string s2 = truncatePrefix(s, maxCodepoints);
136 if (s2 == s)
137 return s;
138 // If string was truncated, move forward a codepoint and prepend a Unicode ellipses character
139 size_t pos = UTF8NextCodepoint(s2, 0);
140 return "…" + s2.substr(pos);
141}
142
143
144bool startsWith(const std::string& str, const std::string& prefix) {

Callers

nothing calls this directly

Calls 2

truncatePrefixFunction · 0.85
UTF8NextCodepointFunction · 0.85

Tested by

no test coverage detected