nulib.text.unicode.utf16

UTF-16 Utilities

Members

Functions

decode
codepoint decode(wchar[2] chr, size_t read)

Decodes a single utf-16 character,

decode
UnicodeSequence decode(inout(wchar)[] str, bool stripBOM)

Decodes a UTF-16 string.

decode
UnicodeSequence decode(nwstring str, bool stripBOM)

Decodes a UTF-16 string.

decodeOne
codepoint decodeOne(nwstring str, size_t offset)

Decodes a single utf-16 character from a nwstring.

encode
nwstring encode(UnicodeSlice slice, bool addBOM)

Encodes a unicode sequence to UTF-16

encode
nwstring encode(UnicodeSequence sequence, bool addBOM)

Encodes a series of unicode codepoints to UTF-16

getBOM
codepoint getBOM(inout(wchar)[] str)

Gets the BOM of the nwstring if it has one.

getBOM
codepoint getBOM(nwstring str)

Gets the BOM of the nwstring if it has one.

getLength
size_t getLength(wchar c)

Gets how many utf-16 units are in the specified character

getUTF16Length
size_t getUTF16Length(codepoint code)

Gets how many utf-16 units are in the specified codepoint

toMachineOrder
nwstring toMachineOrder(inout(wchar)[] str, Endianess fallbackEndian)

Returns a string which is str converted to machine order.

toMachineOrder
nwstring toMachineOrder(nwstring str)

Returns a string which is str converted to machine order.

validate
bool validate(wchar[2] c)

Validates whether the given character is a valid UTF-16 sequence

validate
bool validate(nwstring str)

Validates whether the given nwstring is a valid UTF-16 string.

validate
bool validate(inout(wchar)[] str)

Validates whether the given nwstring is a valid UTF-16 string.

Meta

Authors

Luna Nielsen