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

Function split

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

Source from the content-addressed store, hash-verified

453
454
455inline void split(const skr::stl_u8string_view& s, skr::Vector<skr::stl_u8string_view>& tokens, const skr::stl_u8string_view& delimiters = u8" ")
456{
457 using namespace::skr;
458 skr::stl_u8string::size_type lastPos = s.find_first_not_of(delimiters, 0);
459 skr::stl_u8string::size_type pos = s.find_first_of(delimiters, lastPos);
460 while (skr::stl_u8string::npos != pos || skr::stl_u8string::npos != lastPos)
461 {
462 auto substr = s.substr(lastPos, pos - lastPos);
463 tokens.add(substr); // use emplace_back after C++11
464 lastPos = s.find_first_not_of(delimiters, pos);
465 pos = s.find_first_of(delimiters, lastPos);
466 }
467}
468
469inline skr::stl_u8string join(const skr::Vector<skr::stl_u8string_view>& tokens, const skr::stl_u8string_view& delimiters = u8" ")
470{

Callers 1

skr_lua_logFunction · 0.70

Calls 4

find_first_not_ofMethod · 0.45
find_first_ofMethod · 0.45
substrMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected