| 443 | } |
| 444 | |
| 445 | u32 text::split(const text_view& splitter, sequence<text_view>& pieces, const bool cull_empty) const noexcept |
| 446 | { |
| 447 | text_view view = this->view(); |
| 448 | u32 count = 0; |
| 449 | while(true) |
| 450 | { |
| 451 | const auto [ left, right ] = view.split(splitter); |
| 452 | if(!cull_empty || !left.is_empty()) |
| 453 | pieces.push_back(left); |
| 454 | ++count; |
| 455 | if(right.is_empty()) |
| 456 | break; |
| 457 | view = right; |
| 458 | } |
| 459 | return count; |
| 460 | } |
| 461 | |
| 462 | text& text::replace(const text_view& destination, const text_view& source, const u64 from, const u64 size) |
| 463 | { |