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

Function trim

examples/parallel/parallel.cpp:14–27  ·  view source on GitHub ↗

trim whitespace from the beginning and end of a string

Source from the content-addressed store, hash-verified

12
13// trim whitespace from the beginning and end of a string
14static std::string trim(const std::string & str) {
15 size_t start = 0;
16 size_t end = str.size();
17
18 while (start < end && isspace(str[start])) {
19 start += 1;
20 }
21
22 while (end > start && isspace(str[end - 1])) {
23 end -= 1;
24 }
25
26 return str.substr(start, end - start);
27}
28
29static std::string k_system =
30R"(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