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

Function replace_all

llama.cpp:127–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127static void replace_all(std::string & s, const std::string & search, const std::string & replace) {
128 std::string result;
129 for (size_t pos = 0; ; pos += search.length()) {
130 auto new_pos = s.find(search, pos);
131 if (new_pos == std::string::npos) {
132 result += s.substr(pos, s.size() - pos);
133 break;
134 }
135 result += s.substr(pos, new_pos - pos) + replace;
136 pos = new_pos;
137 }
138 s = std::move(result);
139}
140
141static bool is_float_close(float a, float b, float abs_tol) {
142 // Check for non-negative tolerance

Callers 2

llama_escape_whitespaceFunction · 0.70

Calls 4

lengthMethod · 0.80
findMethod · 0.80
substrMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected