| 453 | |
| 454 | |
| 455 | inline 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 | |
| 469 | inline skr::stl_u8string join(const skr::Vector<skr::stl_u8string_view>& tokens, const skr::stl_u8string_view& delimiters = u8" ") |
| 470 | { |
no test coverage detected