public static TryDecodeCodePoint ( Span |
||
buffer | Span |
|
codePoint | UnicodeCodePoint | |
encodedBytes | int | |
return | bool |
private static IEnumerator <UnicodeCodePoint> GetCodePointsEnumerator(ByteSpan buffer) { while (buffer.Length > 0) { UnicodeCodePoint codePoint; int encodedBytes; if (Utf8Encoder.TryDecodeCodePoint(buffer, out codePoint, out encodedBytes)) { yield return(codePoint); buffer = buffer.Slice(encodedBytes); } else { // TODO: change exception type throw new Exception("Invalid character"); } } }