pub fn peek(it: *Utf8Iterator, n: usize) []const u8 it: *Utf8Iteratorn: usize415
416
417
418
419
420
421
422
423
424
425
426
427 pub fn peek(it: *Utf8Iterator, n: usize) []const u8 {
const original_i = it.i;
defer it.i = original_i;
var end_ix = original_i;
var found: usize = 0;
while (found < n) : (found += 1) {
const next_codepoint = it.nextCodepointSlice() orelse return it.bytes[original_i..];
end_ix += next_codepoint.len;
}
return it.bytes[original_i..end_ix];
}
Look ahead at the next n codepoints without advancing the iterator. If fewer than n codepoints are available, then return the remainder of the string.