MCPcopy Create free account
hub / github.com/Tablecruncher/tablecruncher / trim

Function trim

external/httplib.h:2758–2767  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2756inline bool is_space_or_tab(char c) { return c == ' ' || c == '\t'; }
2757
2758inline std::pair<size_t, size_t> trim(const char *b, const char *e, size_t left,
2759 size_t right) {
2760 while (b + left < e && is_space_or_tab(b[left])) {
2761 left++;
2762 }
2763 while (right > 0 && is_space_or_tab(b[right - 1])) {
2764 right--;
2765 }
2766 return std::make_pair(left, right);
2767}
2768
2769inline std::string trim_copy(const std::string &s) {
2770 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