| 590 | } |
| 591 | |
| 592 | size_t String::findNextBoundary(size_t index, bool backwards) const { |
| 593 | starAssert(index <= size()); |
| 594 | if (!backwards && (index == size())) |
| 595 | return index; |
| 596 | if (backwards) { |
| 597 | if (index == 0) |
| 598 | return 0; |
| 599 | index--; |
| 600 | } |
| 601 | Char c = this->at(index); |
| 602 | while (!isSpace(c)) { |
| 603 | if (backwards && (index == 0)) |
| 604 | return 0; |
| 605 | index += backwards ? -1 : 1; |
| 606 | if (index == size()) |
| 607 | return size(); |
| 608 | c = this->at(index); |
| 609 | } |
| 610 | while (isSpace(c)) { |
| 611 | if (backwards && (index == 0)) |
| 612 | return 0; |
| 613 | index += backwards ? -1 : 1; |
| 614 | if (index == size()) |
| 615 | return size(); |
| 616 | c = this->at(index); |
| 617 | } |
| 618 | if (backwards && !(index == size())) |
| 619 | return index + 1; |
| 620 | return index; |
| 621 | } |
| 622 | |
| 623 | String String::slice(SliceIndex a, SliceIndex b, int i) const { |
| 624 | auto wide = wideString(); |
no test coverage detected