Edit

Share via


StringNormalizationExtensions.TryNormalize Method

Definition

Normalizes the specified span of characters to the specified normalization form.

public static bool TryNormalize(this ReadOnlySpan<char> source, Span<char> destination, out int charsWritten, System.Text.NormalizationForm normalizationForm = System.Text.NormalizationForm.FormC);
static member TryNormalize : ReadOnlySpan<char> * Span<char> * int * System.Text.NormalizationForm -> bool
<Extension()>
Public Function TryNormalize (source As ReadOnlySpan(Of Char), destination As Span(Of Char), ByRef charsWritten As Integer, Optional normalizationForm As NormalizationForm = System.Text.NormalizationForm.FormC) As Boolean

Parameters

source
ReadOnlySpan<Char>

The span of characters to normalize.

destination
Span<Char>

The buffer to write the normalized characters to.

charsWritten
Int32

When this method returns, contains the number of characters written to destination.

normalizationForm
NormalizationForm

The normalization form to use.

Returns

true if the specified span of characters was successfully normalized; otherwise, false.

Exceptions

The specified character span contains an invalid code point or the normalization form is invalid.

Applies to