Redigeeri

Jagamisviis:


Rune.DecodeLastFromUtf16(ReadOnlySpan<Char>, Rune, Int32) Method

Definition

Decodes the Rune at the end of the provided UTF-16 source buffer.

public:
 static System::Buffers::OperationStatus DecodeLastFromUtf16(ReadOnlySpan<char> source, [Runtime::InteropServices::Out] System::Text::Rune % result, [Runtime::InteropServices::Out] int % charsConsumed);
public static System.Buffers.OperationStatus DecodeLastFromUtf16 (ReadOnlySpan<char> source, out System.Text.Rune result, out int charsConsumed);
static member DecodeLastFromUtf16 : ReadOnlySpan<char> * Rune * int -> System.Buffers.OperationStatus
Public Shared Function DecodeLastFromUtf16 (source As ReadOnlySpan(Of Char), ByRef result As Rune, ByRef charsConsumed As Integer) As OperationStatus

Parameters

source
ReadOnlySpan<Char>

A read-only UTF-16 encoded character span.

result
Rune

When this method returns, the decoded rune.

charsConsumed
Int32

When this method returns, the number of bytes read to create the rune.

Returns

Done if the source buffer begins with a valid UTF-16 encoded scalar value. result then contains the decoded Rune, and charsConsumed contains the number of Char values used in the input buffer to encode the Rune.

NeedMoreData if the source buffer is empty or contains only a standalone UTF-16 high surrogate character. result then contains ReplacementChar, and charsConsumed contains the length of the input buffer.

InvalidData if the source buffer begins with an ill-formed UTF-16 encoded scalar value. result then contains ReplacementChar, and charsConsumed contains the number of Char values used to encode the ill-formed sequence. .

Remarks

This method is very similar to DecodeFromUtf16(ReadOnlySpan<Char>, Rune, Int32), except it allows the caller to loop backward instead of forward. The typical calling convention is that on each iteration of the loop, the caller should slice off the final charsConsumed elements of the source buffer.

Applies to