Class UTF16
- Namespace
- SimdUnicode
- Assembly
- SimdUnicode.dll
public static class UTF16
- Inheritance
-
UTF16
- Inherited Members
Fields
- ReplacementCharacter
The replacement character U+FFFD.
Methods
- GetPointerToFirstInvalidChar(char*, int)
Given an input buffer
pInputBufferofinputLengthUTF-16 code units, returns a pointer to the first lone (unpaired) surrogate.
- GetPointerToFirstInvalidCharFallback(char*, int)
Portable version used when no SIMD kernel applies (no ARM64 NEON, AVX-512, AVX2 or SSE4.1): we rely on the runtime's vectorized IndexOfAnyInRange to skip everything that is not a surrogate.
- IsWellFormed(ReadOnlySpan<char>)
Returns true if
inputcontains no lone surrogate.
- ToWellFormed(char*, int, char*)
Copies
inputLengthUTF-16 code units frompInputBuffertopOutputBuffer, replacing every lone surrogate by U+FFFD. The two buffers must either be identical (in-place operation) or not overlap.
- ToWellFormed(ReadOnlySpan<char>, Span<char>)
Copies
sourcetodestination, replacing every lone surrogate by U+FFFD. The spans must either start at the same address (in-place operation) or not overlap.
- ToWellFormed(string)
Returns a well-formed copy of
inputwhere every lone surrogate is replaced by U+FFFD. Ifinputis already well formed, it is returned as is (no allocation).
- ToWellFormedFallback(char*, int, char*)
Portable version used when no SIMD kernel applies (see GetPointerToFirstInvalidCharFallback(char*, int)).
- ToWellFormedScalar(char*, int, char*)
Straightforward scalar version, a port of simdutf's scalar::utf16::to_well_formed_utf16.