* Read data until the first occurrence of 'str', and advance reader. * @param str Separator string. * @param sep Whether to include/exclude 'str' from the result, and/or skip it. */
| 709 | * @param sep Whether to include/exclude 'str' from the result, and/or skip it. |
| 710 | */ |
| 711 | [[nodiscard]] std::string_view ReadUntil(std::string_view str, SeparatorUsage sep) |
| 712 | { |
| 713 | assert(!str.empty()); |
| 714 | auto result = this->PeekUntil(str, sep); |
| 715 | this->Skip(result.size()); |
| 716 | switch (sep) { |
| 717 | default: |
| 718 | break; |
| 719 | case SKIP_ONE_SEPARATOR: |
| 720 | this->SkipIf(str); |
| 721 | break; |
| 722 | case SKIP_ALL_SEPARATORS: |
| 723 | while (this->ReadIf(str)) {} |
| 724 | break; |
| 725 | } |
| 726 | return result; |
| 727 | } |
| 728 | /** |
| 729 | * Skip data until the first occurrence of 'str'. |
| 730 | * @param str Separator string. |
no test coverage detected