MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / trim

Function trim

smallthinker/examples/parallel/parallel.cpp:18–31  ·  view source on GitHub ↗

trim whitespace from the beginning and end of a string

Source from the content-addressed store, hash-verified

16
17// trim whitespace from the beginning and end of a string
18static std::string trim(const std::string & str) {
19 size_t start = 0;
20 size_t end = str.size();
21
22 while (start < end && isspace(str[start])) {
23 start += 1;
24 }
25
26 while (end > start && isspace(str[end - 1])) {
27 end -= 1;
28 }
29
30 return str.substr(start, end - start);
31}
32
33static std::string k_system =
34R"(Transcript of a never ending dialog, where the User interacts with an Assistant.

Callers 1

mainFunction · 0.70

Calls 2

substrMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected