Function calcWtf16LeLen [src]

Returns length in WTF-16LE of WTF-8 slice as length of []u16. Length in []u8 is 2*len16.

Prototype

pub fn calcWtf16LeLen(wtf8: []const u8) CalcWtf16LeLenError!usize

Parameters

wtf8: []const u8

Possible Errors

Utf8CodepointTooLarge Utf8Decode4Error
Utf8ExpectedContinuation Utf8Decode2Error
Utf8InvalidStartByte
Utf8OverlongEncoding Utf8Decode2Error

Example

test calcWtf16LeLen { try testCalcUtf16LeLenImpl(calcWtf16LeLen); try comptime testCalcUtf16LeLenImpl(calcWtf16LeLen); }

Source

pub fn calcWtf16LeLen(wtf8: []const u8) CalcWtf16LeLenError!usize { return calcUtf16LeLenImpl(wtf8, .can_encode_surrogate_half); }