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

Function replace_all

smallthinker/src/llama-impl.cpp:65–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65void replace_all(std::string & s, const std::string & search, const std::string & replace) {
66 if (search.empty()) {
67 return;
68 }
69 std::string builder;
70 builder.reserve(s.length());
71 size_t pos = 0;
72 size_t last_pos = 0;
73 while ((pos = s.find(search, last_pos)) != std::string::npos) {
74 builder.append(s, last_pos, pos - last_pos);
75 builder.append(replace);
76 last_pos = pos + search.length();
77 }
78 builder.append(s, last_pos, std::string::npos);
79 s = std::move(builder);
80}
81
82std::string format(const char * fmt, ...) {
83 va_list ap;

Callers 5

gguf_kv_to_strFunction · 0.70
llama_escape_whitespaceFunction · 0.70
llama_model_loaderMethod · 0.70

Calls 5

reserveMethod · 0.80
lengthMethod · 0.80
findMethod · 0.80
emptyMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected