the range to encode
A UTF-16 string
import std.algorithm.comparison : equal; // these graphemes are two code units in UTF-16 and one in UTF-32 assert("𤭢"d.length == 1); assert("𐐷"d.length == 1); assert("𤭢"d.toUTF16.equal([0xD852, 0xDF62])); assert("𐐷"d.toUTF16.equal([0xD801, 0xDC37]));
For a lazy, non-allocating version of these functions, see byUTF.
Encodes the elements of s to UTF-16 and returns a newly GC allocated wstring of the elements.