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

Function trim

smallthinker/src/llama-chat.cpp:16–26  ·  view source on GitHub ↗

trim whitespace from the beginning and end of a string

Source from the content-addressed store, hash-verified

14
15// trim whitespace from the beginning and end of a string
16static std::string trim(const std::string & str) {
17 size_t start = 0;
18 size_t end = str.size();
19 while (start < end && isspace(str[start])) {
20 start += 1;
21 }
22 while (end > start && isspace(str[end - 1])) {
23 end -= 1;
24 }
25 return str.substr(start, end - start);
26}
27
28static const std::map<std::string, llm_chat_template> LLM_CHAT_TEMPLATES = {
29 { "chatml", LLM_CHAT_TEMPLATE_CHATML },

Callers 1

llm_chat_apply_templateFunction · 0.70

Calls 2

substrMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected