MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / replace

Method replace

modules/gui/gui/src/backend/text_server/ustring.cpp:4097–4118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4095}
4096
4097String String::replace(const String& p_key, const String& p_with) const
4098{
4099 String new_string;
4100 int search_from = 0;
4101 int result = 0;
4102
4103 while ((result = find(p_key, search_from)) >= 0)
4104 {
4105 new_string += substr(search_from, result - search_from);
4106 new_string += p_with;
4107 search_from = result + p_key.length();
4108 }
4109
4110 if (search_from == 0)
4111 {
4112 return *this;
4113 }
4114
4115 new_string += substr(search_from, length() - search_from);
4116
4117 return new_string;
4118}
4119
4120String String::replace(const char* p_key, const char* p_with) const
4121{

Callers 15

path_to_fileMethod · 0.95
path_toMethod · 0.95
load_headerMethod · 0.45
old_framework.pyFile · 0.45
__init__Method · 0.45
add_includeMethod · 0.45
set_namesMethod · 0.45
replaceFunction · 0.45
log_sink.cppFile · 0.45
assignMethod · 0.45
text.cppFile · 0.45

Calls 4

substrFunction · 0.85
findFunction · 0.50
lengthFunction · 0.50
lengthMethod · 0.45

Tested by

no test coverage detected