語言

Rune.DecodeLastFromUtf8(ReadOnlySpan<Byte>, Rune, Int32) 方法

定義

解碼 Rune 於提供的 UTF-8 來源緩衝區末端。

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

參數

source
ReadOnlySpan<Byte>

一個唯讀的 UTF-8 編碼位元組區間。

value
Rune

當這個方法回來時,解碼後的符文。

bytesConsumed
Int32

當此方法回傳時,會讀取用於創建符文的位元組數。

傳回

Done 若來源緩衝區末尾為有效的 UTF-8 編碼標量值。 value則包含解碼後Rune的 ,並bytesConsumed包含輸入緩衝區中用來編碼 的Rune值數量Byte。

NeedMoreData 若原始緩衝區為空或僅包含獨立的 UTF-8 高代替代字元。 value 則包含 ReplacementChar,且 bytesConsumed 包含輸入緩衝區的長度。

InvalidData 如果來源緩衝區末端為未成形的 UTF-8 編碼純量值。 value 則包含 ReplacementChar,且 bytesConsumed 包含 Byte 輸入緩衝區中用來編碼錯誤序列的數值。

備註

此方法與 非常相似 DecodeFromUtf8(ReadOnlySpan<Byte>, Rune, Int32),但允許呼叫者向後迴圈而非向前迴圈。 典型的呼叫慣例是,每次迴圈迭代時,呼叫者都應該切出緩衝區的source最後元素bytesConsumed。

適用於