A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://learn.microsoft.com/en-us/dotnet/api/system.text.rune.decodefromutf16 below:

Rune.DecodeFromUtf16(ReadOnlySpan<Char>, Rune, Int32) Method (System.Text)

Rune.DecodeFromUtf16(ReadOnlySpan<Char>, Rune, Int32) Method Definition

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

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

When this method returns, the decoded rune.

charsConsumed
Int32

When this method returns, the number of characters 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

The general convention is to call this method in a loop, slicing the source buffer by charsConsumed elements on each iteration of the loop. On each iteration of the loop, result contains the real scalar value if the data was successfully decoded, or it contains Rune.ReplacementChar if the data was not successfully decoded. This pattern provides convenient automatic U+FFFD substitution of invalid sequences while iterating through the loop.

Collaborate with us on GitHub

The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide. In this article

Was this page helpful?


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4