commit c3eb1d839343abc7edebdf22bcf72872ced83cb9 parent 7554649a89a3968a24af8d54078a338c8a6549ce Author: Drew DeVault <sir@cmpwn.com> Date: Wed, 3 Feb 2021 16:20:13 -0500 strings: add iterstr function Diffstat:
M | strings/iter.ha | | | 5 | +++++ |
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/strings/iter.ha b/strings/iter.ha @@ -15,3 +15,8 @@ export fn next(iter: *iterator) (rune | void) = { utf8::invalid => abort("Invalid UTF-8 string (this should not happen)"), }; }; + +// Return a substring from the next rune to the end of the string. +export fn iterstr(iter: *iterator) str = { + return from_utf8(iter.src[iter.offs..]); +};