MCPcopy Create free account
hub / github.com/computationalpathologygroup/ASAP / trim

Function trim

core/stringconversion.cpp:57–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57void trim(std::string &s)
58{
59 if (s.empty()) return;
60 unsigned int pos1 = 0, pos2 = (unsigned int) s.size() - 1;
61 while ((pos1 < s.size()) && s[pos1] < 33) ++pos1;
62 while ((pos2 > 0) && s[pos2] < 33) --pos2;
63 ++pos2;
64 if (pos2 > pos1) s = std::string(s.begin() + pos1, s.begin() + pos2);
65}
66
67void replaceAll(std::string& s, const std::string& item, const std::string& replacement) {
68 size_t pos = 0;

Callers

nothing calls this directly

Calls 2

emptyMethod · 0.80
sizeMethod · 0.80

Tested by

no test coverage detected