MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / string_replace_all

Function string_replace_all

common/common.cpp:445–460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

443}
444
445void string_replace_all(std::string & s, const std::string & search, const std::string & replace) {
446 if (search.empty()) {
447 return;
448 }
449 std::string builder;
450 builder.reserve(s.length());
451 size_t pos = 0;
452 size_t last_pos = 0;
453 while ((pos = s.find(search, last_pos)) != std::string::npos) {
454 builder.append(s, last_pos, pos - last_pos);
455 builder.append(replace);
456 last_pos = pos + search.length();
457 }
458 builder.append(s, last_pos, std::string::npos);
459 s = std::move(builder);
460}
461
462std::string regex_escape(const std::string & s) {
463 static const std::regex special_chars("[.^$|()*+?\\[\\]{}\\\\]");

Callers 12

to_iniMethod · 0.70
load_from_models_dirMethod · 0.70
get_value_from_envMethod · 0.70
has_value_from_envMethod · 0.70
get_envMethod · 0.70
clean_file_nameFunction · 0.70
folder_name_to_repoFunction · 0.70
repo_to_folder_nameFunction · 0.70
make_old_cache_filenameFunction · 0.70
mainFunction · 0.50
write_table_entryFunction · 0.50

Calls 4

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

Tested by

no test coverage detected