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

Function replaceAll

modules/engine/lua/src/build.skr_lua.cpp:38–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36};
37
38void replaceAll(skr::stl_u8string& str, const skr::stl_u8string_view& from, const skr::stl_u8string_view& to) {
39 if(from.empty())
40 return;
41 size_t start_pos = 0;
42 while((start_pos = skr::stl_u8string_view(str).find(from, start_pos)) != std::string::npos) {
43 str.replace(start_pos, from.length(), to.data(), to.length());
44 start_pos += to.length(); // In case 'to' contains 'from', like replacing 'x' with 'yx'
45 }
46}
47
48static skr::FlatHashMap<lua_State*, void*> ExtraSpace;
49void** lua_getextraspace(lua_State* L)

Callers 2

skr_lua_loadfileFunction · 0.85
replaceAllMethod · 0.85

Calls 5

emptyMethod · 0.45
findMethod · 0.45
replaceMethod · 0.45
lengthMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected