Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

utf16CountCodepoints

Returns the length of a supplied UTF-16 string literal in terms of unicode codepoints.

unicode.utf16CountCodepoints
pub fn utf16CountCodepoints(utf16le: []const u16) !usize

File

lib/std/unicode.zig:518

Code

pub fn utf16CountCodepoints(utf16le: []const u16) !usize {
    var len: usize = 0;
    var it = Utf16LeIterator.init(utf16le);
    while (try it.nextCodepoint()) |_| len += 1;
    return len;
}