Function utf16CountCodepoints [src]
Returns the length of a supplied UTF-16 string literal in terms of unicode
codepoints.
Prototype
pub fn utf16CountCodepoints(utf16le: []const u16) !usize
Parameters
utf16le: []const u16
Source
pub fn utf16CountCodepoints(utf16le: []const u16) !usize {
var len: usize = 0;
var it = Utf16LeIterator.init(utf16le);
while (try it.nextCodepoint()) |_| len += 1;
return len;
}