MCPcopy Create free account
hub / github.com/cginternals/globjects / trim

Function trim

source/globjects/source/IncludeProcessor.cpp:22–27  ·  view source on GitHub ↗

From http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring

Source from the content-addressed store, hash-verified

20
21// From http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring
22inline std::string trim(const std::string &s)
23{
24 auto wsfront=std::find_if_not(s.begin(),s.end(),[](int c){return std::isspace(c);});
25 auto wsback=std::find_if_not(s.rbegin(),s.rend(),[](int c){return std::isspace(c);}).base();
26 return (wsback<=wsfront ? std::string() : std::string(wsfront,wsback));
27}
28
29inline bool contains(const std::string& string, const std::string& search)
30{

Callers 1

processMethod · 0.85

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected