MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / trim

Function trim

dependencies/httplib/httplib.h:2125–2134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2123inline bool is_space_or_tab(char c) { return c == ' ' || c == '\t'; }
2124
2125inline std::pair<size_t, size_t> trim(const char *b, const char *e, size_t left,
2126 size_t right) {
2127 while (b + left < e && is_space_or_tab(b[left])) {
2128 left++;
2129 }
2130 while (right > 0 && is_space_or_tab(b[right - 1])) {
2131 right--;
2132 }
2133 return std::make_pair(left, right);
2134}
2135
2136inline std::string trim_copy(const std::string &s) {
2137 auto r = trim(s.data(), s.data() + s.size(), 0, s.size());

Callers 2

trim_copyFunction · 0.85
splitFunction · 0.85

Calls 1

is_space_or_tabFunction · 0.85

Tested by

no test coverage detected