Επεξεργασία

Κοινή χρήση μέσω


Rune.DecodeLastFromUtf8(ReadOnlySpan<Byte>, Rune, Int32) Method

Definition

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

public:
 static System::Buffers::OperationStatus DecodeLastFromUtf8(ReadOnlySpan<System::Byte> source, [Runtime::InteropServices::Out] System::Text::Rune % value, [Runtime::InteropServices::Out] int % bytesConsumed);
public static System.Buffers.OperationStatus DecodeLastFromUtf8 (ReadOnlySpan<byte> source, out System.Text.Rune value, out int bytesConsumed);
static member DecodeLastFromUtf8 : ReadOnlySpan<byte> * Rune * int -> System.Buffers.OperationStatus
Public Shared Function DecodeLastFromUtf8 (source As ReadOnlySpan(Of Byte), ByRef value As Rune, ByRef bytesConsumed As Integer) As OperationStatus

Parameters

source
ReadOnlySpan<Byte>

A read-only UTF-8 encoded byte span.

value
Rune

When this method returns, the decoded rune.

bytesConsumed
Int32

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

Returns

Done if the source buffer ends with a valid UTF-8 encoded scalar value. result then contains the decoded Rune, and bytesConsumed contains the number of Byte values used in the input buffer to encode the Rune.

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

InvalidData if the source buffer ends with an ill-formed UTF-8 encoded scalar value. result then contains ReplacementChar, and bytesConsumed contains the number of Byte values used in the input buffer to encode the ill-formed sequence.

Remarks

This method is very similar to DecodeFromUtf8(ReadOnlySpan<Byte>, 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 bytesConsumed elements of the source buffer.

Applies to