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

Function trim

src/string.cpp:68–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66
67
68std::string trim(const std::string& s) {
69 const std::string whitespace = " \n\r\t";
70 size_t first = s.find_first_not_of(whitespace);
71 if (first == std::string::npos)
72 return "";
73 size_t last = s.find_last_not_of(whitespace);
74 if (last == std::string::npos)
75 return "";
76 return s.substr(first, last - first + 1);
77}
78
79
80std::string truncate(const std::string& s, size_t maxCodepoints) {

Callers 1

onChangeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected