MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / replace_all

Function replace_all

subprojects/llama.cpp/src/llama-impl.cpp:69–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 5

gguf_kv_to_strFunction · 0.85
llama_escape_whitespaceFunction · 0.85
llama_model_loaderMethod · 0.85

Calls 4

emptyMethod · 0.65
lengthMethod · 0.65
findMethod · 0.65
appendMethod · 0.65

Tested by

no test coverage detected